| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
OK, first off, a small introduction: I'm new here, and learning C++ at school - I'm 15 (almost 16) years old. And reading ahead in the book
Anyway, I have: int Place[30][30]; for(int Count1 = 0;Count1 < 30;Count1++) { for(int Count2 = 0;Count2 < 30;Count2++) { Place[Count1][Count2] = 9; } } So, a 30x30 array of ints filled with 9s. What I'm wondering is if there is a simple way of changing the first 12x12 into 1s and 0s. Yes, this may seem like a strange question, but I am testing my limits by trying to make a *very* simple text-based game. |
|
#2
|
|||
|
|||
|
From another board: the quote on a reply, and my answer.
Quote:
Hrm.... A checkerboard of 1s and 0s... Well... <looks back> I shoulda explained a bit better... Okay. Here's the scenario: A 30x30 array of 9s. a 12x12 array of 1s and 0s, different patterns an whole buncha stuff. I want the 12x12 array to be inserted in the start of the 30x30 array. I was looking in my C++ book earlier today, and found a section on "Vectors", but since it only had an example, and not even all the source for the example, I couldn't figure it out. But it did say that "Vector" is a term for a 1 dimensional array.... Is there a 2 dimen. version? The one in the book could is the assignment operator to change the size of the receiving array and assign another array to equal it... Just what I'm looking for, except wrong # of dimensions.... |
|
#3
|
|||
|
|||
|
Neeeever mind, I can use nested loops to copy it element by element....
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > C++, Arrays, Changing only parts. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|