C++ Array Access element in an array one by one with for loop and array index
#include <iostream> using namespace std; int main()/*from w w w . j ava2 s . c o m*/ { const int ARRAYSIZE = 5; int i, grade[ARRAYSIZE] = {98, 87, 92, 79, 85}; for (i = 0; i < ARRAYSIZE; i++) cout << "\nElement " << i << " is " << grade[i]; cout << endl; return 0; }