/* testarr03.cpp CIS 150 06/19/2008 David Klick Demonstration of array auto-sizing. */ #include using std::cin; using std::cout; void cont(); int main() { // C++ will automatically make array large // enough to store initializtion list items. int nums[] = { 1, 2, 3, 4, 5 }; int i; // display array elements (only 5 now) for (i=0; i<5; 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 */