1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std; // Shortens my code work by avoiding the use of std;
int main ()
{
int myArray [3] [5] =
{
{0, 1, 2, 3, 4 } ,
{ 0, 2, 4, 6, 8 },
{ 0, 4, 6, 8, 10 }
}; // Using a bidimensional array to create a 3 x 5 space;
int i, j; // Declaring two integers;
for ( int i = 0 ; i < 2; i++ ) // Loop starts here, I try to use i as the first dimension;
{
for ( int j = 0 ; int < 5; j++ ) // The second loop, uses j as the second dimension,
//This loop where the problem appears when I try to compile the file;
{
cout << myArray [i] [j] << endl; // Should display my results in the output of the console;
}
}
return 0;
}
|