Mar 12, 2015 at 12:02pm UTC
and what if i don't want to use auto & ect because I haven't learnt it yet?
how should I write it instead?
Thanks for replying =)
Mar 12, 2015 at 1:07pm UTC
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream IN("input.txt" );
int input;
IN >> input;
int X[2][4][5];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 5; k++)
{
X[i][j][k] = 0; // initialize all vavlues to 0
}
}
}
// read input
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 5; k++)
{
IN >> input;
X[i][j][k] = input;
}
}
}
// display input
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 5; k++)
{
std::cout << X[i][j][k] << " " ;
}
std::cout << std::endl;
}
std::cout << std::endl;
}
system("pause" );
return 0;
}
Last edited on Mar 12, 2015 at 1:08pm UTC
Mar 12, 2015 at 1:29pm UTC
that's really what I needed!
Thanks a lot to everyone! =D