#include <iostream>
const int ARRAYSIZE = 1000;
main()
{
int size; // contains how many values are actually
// in the array
int arr[ARRAYSIZE];
int i;
int val;
cout << "Welcome" << endl << endl;
cout << "Reading values from the file" << endl;
// read values into the array until a value of -1 is read in
cin >> val;
i = 0;
while (val >= 0)
{
// store the value into the array
arr[i] = val;
i++;
// read in the next value
cin >> val;
}
// set size based on the current value of i
size = i;
cout << endl << "Show the value: " << endl;
// Display the values in the array
for (i = 0; i < size; i++)
{
cout << arr[i] << " ";
if ((i+1) % 5 == 0)
cout << endl;
}
cout << endl << "Goodbye" << endl;
}