Multi dimensional arrays


Posted on 16th Feb 2014 07:03 pm by admin

If I put in this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include using namespace std; int place[10][10] = {{0,1,2,3,4,5,6,7,8,9},{9,8,7,6,5,4,3,2,1,0}}; int i; int main(){ for(i=0; i<10; i++){ cout << i << endl; cout << place[i][i] << endl; cout << place[i][i] << endl; cout << "n" << endl; } }

I get:

0 1 2 3 4 5 6 7 8 9 0 8 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0

When I want to get:

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 0

So how would I correctly define the array? Also it returns no errors and it was compiled with GCC.

No comments posted yet

Your Answer:

Login to answer
204 Like 10 Dislike
Previous forums Next forums
Other forums

Error querying database.
I get the above error when trying to insert some values to a datatable.
Here's the code :

Taylor Series Function
So I am working a a project for my intro C++ class, and I am having some trouble with a function for

HOW to get the bind variables list.
I've the following problem : I've some SQL queries stored in my DB as VARCHAR2 values.
I need t

Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named

Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i wou

Members Only
Hi all, for my website i have a members area only which on members can veiw, but at the moment anyon

Problem with coding MySQL query
I'm having heaps of trouble getting one of my PHP/MySQL queries to work for some reason (and the fun

add to sql result
ok see rite now my sites hit counter is counted from the mysql visitor log i need to clear it aft

Tree Menu
Hi guys,

Can anyone help me making a tree navigation system? I have a site where I'm allowin

cURL proxy
Okay here is the thing... i know how to add proxys

Code: curl_setopt($ch, CURLOPT_PROXYTYPE,

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash