hi guys,
this is my code but after compiling it, this statement appears "1>c:\users\patricia\documents\visual studio 2010\projects\double_array\double_array\double_array.cpp(58): error C2109: subscript requires array or pointer type
"
what does that array or pointer type means?
this is my code
please help me!
thank you
by the way this is what my teacher wants:
this is my code but after compiling it, this statement appears "1>c:\users\patricia\documents\visual studio 2010\projects\double_array\double_array\double_array.cpp(58): error C2109: subscript requires array or pointer type
"
what does that array or pointer type means?
this is my code
#include <iostream> #include <iomanip> using namespace std; const int Dimension = 5; int main() { int list[Dimension][Dimension]; int value = 1; for (int i = 0; i < Dimension; ++i) for (int j = 0; j < Dimension; ++j) { list[i][j] = value++; cout << setw(2) << list[i][j] << (!((j + 1) % Dimension) ? '\n' : ' '); } value = 0; for (int i = 0, n = 1; i < Dimension; ++i, ++n) for (int j = 0; j < Dimension; ++j, ++n) if (!(n % Dimension) && (!(Dimension % 2) || n / Dimension != Dimension / 2 + 1)) value += list[i][j]; for (int i = Dimension - 1, n = 0; i >= 0; --i, ++n) for (int j = Dimension - 1; j >= 0; --j, ++n) if (!(n % Dimension)) value += list[i][j]; cout << "\nSum is: " << value << endl; return 0; }
please help me!
thank you
by the way this is what my teacher wants: