/* testarr02.cpp CIS 150 06/19/2008 David Klick Demonstration of array initialization. */ #include using std::cin; using std::cout; void cont(); int main() { // declare and initialize array. int nums[10] = { 1, 2, 3, 4, 5 }; int i; // display array elements for (i=0; i<10; i++) { cout << nums[i] << " "; } cout << '\n'; cont(); return 0; } /* void cont(); Arguments: none Returns: nothing Clears input buffer and pauses waiting for user to press Enter. */ void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); } /* Sample output: 1 2 3 4 5 0 0 0 0 0 */