arrays

enter array input n solve some question with method

i need to know how to do array. but, we insert the input and no user input. when complete the table, we must show the average, maximum score, minimum score and identify which the table has maximum or minimum score using the method.. can help me? ...

Is the following array well defined for binary search?

Hello, I have a file with consisted of int;int values in each line. Both columns are ascending, row by row. I plan to load that file into an array with following code: while( ! feof($f) ) { $line = fgets( $f, 32 ); $tmp = explode( ";", $line ); $elements[] = array( $tmp[0] => $tmp[1] ); } I intend to use this array to do ...

keeping array in an array

i want to save kingarray[x1+1,y1-1],king array[x1+1,y1],etc in an array(ways that king in chess game can go).how can i do it?or if its not possible what do you suggest me to keep the ways that king can go?thanks int[,] kingarray = new int[8, 8]; for (i = 0; i < 1; i++) { return kingarray[x1 + 1, y1]; } for (i = 1; i > 0; i--) {...

Java - Enum with array field

Hey, I want to store a list names and individual nicknames for each name as an Enum in Java. The number of nicknames will not vary. The purpose is to be able to get a full name from a nickname. Currently I have implemented this like so: public enum Names { ELIZABETH(new String[] {"Liz","Bet"}), ... ; private Strin...

Add a callback function to a Ruby array to do something when an element is added

I'd like to add something like a callback function to a Ruby array, so that when elements are added to that array, this function is called. One thing I can think of is to override all methods (like <<, =, insert, ...) and call that callback from there. Is there an easier solution? ...

Get char at index location in char array Assembly X86 embedded

Hello, I am having a lot of trouble accessing a value in an array of chars at a specific location. I am using inline-assembly in C++ and using visual studio (if that is of any help). Here is my code: char* addTwoStringNumbers(char *num1) { // here is what I have tried so far: movzx eax, num1[3]; mov al, [eax] } When I debu...

Assembly Language Arrays

This is a pretty simple question.. lets say I have the following. wordArray WORD 810Dh, 0C064h, 93ABh Now, if I do this... MOVZX EAX, wordArray Thats going to move the first value of the array onto EAX.. so EAX would look something like this.. 0000810D. My question is, how can I move ALL of the array onto EAX.. so EAX would look ...

Array-strings sorted using qSort in C

the question is simple: there is some way that the ordered array that returns me the "qsort", is returned in reverse, ie I want to avoid the use of any auxiliary array to invest the resulting array using qsort. this is my code, which reads from standard input strings to be sorted, and uses a comparison function for sorting. #includ...

Convert text file into 2d array in vb.net

I have a text file like 11111 10001 10001 11111 I need to read this into a 2d array of integers I already have the code to read the file Dim fullpath = "Path to File" Dim objReader As StreamReader objReader = New StreamReader(fullpath) But i dont know what to do after that. I'm know this is something simple but i just cant think...

Iteratively filling an array with hashes from an each/do block gives me all repeat values..help!

I am trying to fill an array of hashes with hashes created through an each loop, If I print each individual hash within the iteration they are distinct, but when I try to push them to an array, the resulting array has the last hash repeated whatever number of times. Here's the code: def get_tweets tweet_array = Array.new tweet = {} ...

Where can I learn about CS Scrpit?

Hi, I have this piece of code: var arrayParamaters = sParameters["split"]("|"); I want to find a documentation that map the functions/variables of a cs script var. as in the example I treat the sParameters as an array, and I would like to know the functions I can use with it... Adam. ...

problem with compare two array with foreach

Hi, sorry for my english,but I have problem because I seek the same values of field and when I find the same value I print a message , if I don t find a same values I print an error message but this error message is repated and I want to print once if they are no same values this my code: foreach($row2 as $key => $value) { ...

Issue posting variable with iPhone SDK

Hey everyone, I am encountering an issue while posting a variable with Xcode: While running this code the app crashes while posting the variable to a webservice: NSArray *array = [stringFromFile componentsSeparatedByString: @","]; NSString *time = [array objectAtIndex:1]; UTCorLocal = time; NSLog(@"%@", UTCorLocal); UTCorLocal varia...

Using APC to store data in arrays

Hello, I'm currently attempting to implement APC caching as a datastore in my web application. Currently, the system retrieves data directly from the MySQL database, and requires a database call per request. I'm currently attempting to change this by prepopulating the cache with data which is intercepted and served from the cache at e...

Space in the ruby array by %w

How can i add space character in the ruby array if i want to use %w(a b c) syntax? ...

2d array of lists in python

Hello, everyone! I am trying to create a 2d matrix so that each cell contains a list of strings. Matrix dimensions are known before the creation and I need to have access to any element from the beginning (not populating a matrix dynamically). => I think some kind of preallocation of space is needed. For example, I would like to have a...

X86 inline assembly, writing into C array

Assembly info: Using Visual Studio 2010 to write inline assembly embedded into C Hello, I am trying to write into an array of chars in C and trying to mimic the action of this C code: resNum[posNum3] = currNum3 + '0'; currently this is what i have: mov ebx, posNum3; mov resNum[ebx], edx; //edx is currNum3 add resNum[ebx], 48; // a...

APC not storing data from MySQLi result array

Hello, I'm havin trouble storing an array of data. Below is the code use in the web application to check to see if the data is there, and if it's there serve it, else, cache it then serve it. I am using MySQLi $id = $db->real_escape_string($_GET['id']); $key = 'content_' . $app; $data = apc_fetch($key); if (!is_array($data)) { $r...

PHP: Using a variable name, doesn't work on arrays?

I'm trying to figure out why this works: $joe = "hey joe"; $something = "joe"; print_r(${$something}); But this doesn't: $joe["where_you_going"] = "hey joe"; $something = "joe[where_you_going]"; print_r(${$something}); Why is this? Is there a way to do what I attempted in the second example? ...

Compare 2 arrays for likeness

How would I compare 2 Arrays in PHP to find which values each array have in common. Example would be Array 1 Array ( [0] => ace [1] => one [2] => five [3] => nine [4] => elephant ) Array 2 Array ( [0] => elephant [1] => seven [2] => ace [3] => jack [4] => queen ) Output Array ( [0] => a...