// arrays2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream.h" int num[10]; int length = 0; void fill_array() { char response; int x; response = 'y'; x = 0; while (response == 'y') { cout << "enter a number for the array: " << endl; cin >> num[x]; x++; length = x; cout << "continue y/n" << endl; cin >> response; } } void print_array() { for (int x = 0; x < length; x++) cout << num[x] << endl; if (length == 0) cout << "list is empty" << endl; } int _tmain(int argc, _TCHAR* argv[]) { fill_array(); print_array(); return 0; }