![]() |
|
#1
|
|||
|
|||
Need Help With Arrays!!!Okay, this is my second semester in a C++ class, so I'm still new at this, and we're on multidimensional arrays.
Here's the problem: The array is 120 by 120, and I need to put values in each one of those spots, of which are two numbers, I'll call them x and y. Another factor is the 120 by 120 are divided into columns and rows, I'll call them i and j. The array will look something like this: x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x y y y x x x y y y x x x y y y y y y x x x y y y x x x y y y y y y x x x y y y x x x y y y y y y x x x y y y x x x y y y x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x x x x y y y x x x y y y x x x ..... so like a checkerboard... 120 of these across, in this case, 120/40 = i across and 120/30 = j x x x x x x x x x x x x I hoooopppeee all this makes sense The problem I am having is inserting the x's and the y's into the array, and how they go in the correct location, I also do not know the numbers that i and j represent. |
|||
|
#2
|
|||
|
|||
Re: Need Help With Arrays!!!You could create nested loops:
CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
Re: Need Help With Arrays!!!Quote:
why the 6s and 3s? |
|
#4
|
|||
|
|||
Re: Need Help With Arrays!!!I implemented that code into my program, and the output was a bit different than I needed, maybe a mistake, it was like this
xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy rather than: xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy yyyxxxyyyxxxyyyxxx yyyxxxyyyxxxyyyxxx yyyxxxyyyxxxyyyxxx xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy xxxyyyxxxyyyxxxyyy |
|
#5
|
|||
|
|||
Re: Need Help With Arrays!!!Based on your pattern...
Code:
Code:
Does this make sense? |
|
#6
|
|||
|
|||
Re: Need Help With Arrays!!!CPP / C++ / C Code:
|
|
#7
|
|||
|
|||
Re: Need Help With Arrays!!!Thank you, I think I understand now
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help with input files. | Efferus | C++ Forum | 2 | 24-Nov-2007 17:19 |
| Arrays as function arguments - return arrays from functions | pisuke | C Programming Language | 2 | 25-Jul-2007 12:03 |
| Dynamic vs Static Arrays | WaltP | Miscellaneous Programming Forum | 5 | 16-Feb-2006 16:54 |
| I am reviewing Arrays and need help converting some strings to arrays | jenmaz | C Programming Language | 22 | 23-Nov-2004 00:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The