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

Validating time
Hi Guys

what do you think of the following approach to validate a 24hour time:

http://

Mail functionality from localhost to server
Hi

I am facing problem of mail functionality.

When i tested mail functionality in my

Need understanding of this bit of code
Code: <?php
// WHERE clause filters
$arrSQLFilters = array();

//

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

array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.

the followi

MySQL Primary key gap
Alright, so I have a table with 26 entries in it (id, filename, caption) for my image randomiser (ht

onClick='location.href=index.htm'> not working
Below is my code:

echo "<input type='button' value='redirect' onClick='location.h

Problem Dereferencing
With these types and tables:

CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,

Applet JTextField Size Problem
Hello,

I recently started making an applet to calculate certain values for airplanes. However

Help with lottery style system?
I'm working on a currency system for forums and it is going to have a type of lottery system built i

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