/* File: fig07_05.cpp */ #include #include int main() { // constant variable can be used to specify array size const int nSize = 10; // const variables must be initialized, otherwise it is a compiler error. int n[nSize]; // n is an array of 10 integers for(int i = 0; i < nSize; i++) { n[i] = 2 + 2 * i; }; // output each array element's value std::cout << "Element" << std::setw(13) << "Value" << std::endl; for(int j = 0; j < nSize; j++) { std::cout << std::setw(7) << j << std::setw(13) << n[j] << std::endl; }; return 0; };