Help displaying the numbers in the vector

Hi! I have an assignment I have to do that is described as follows:

"Write a C++ program to input integer numbers into a vector named fmax and determine the maximum value entered in the vector and the index number for the maximum. The program should loop until -999 is entered. The maximum value and element number should be determined as vector element values are being input. Display the contents of the vector and the following two messages with the values found.

The vector contains { n, n, n, n, … } where n is the numbers in the vector
The maximum value is: _____
This is element number _____ in the list of numbers."

I have everything coded but this particular part:
The vector contains { n, n, n, n, … } where n is the numbers in the vector

My code is pasted below, when I do enter numbers it looks like this on the output:

Please Enter Integers
12
Enter numbers 1:2
Enter numbers 2:11
Enter numbers 3:33
Enter numbers 4:44
Enter numbers 5:2
Enter numbers 6:1
Enter numbers 7:7
Enter numbers 8:8
Enter numbers 9:54
Enter numbers 10:-999
The Maximum Value Is: 54
This Is element Number 9 In The list of Numbers
Press any key to continue . . .

but again it does not display the numbers that were entered in the line like I said before...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int count = 0;
	int numbers;
	vector<int> fmax;
	int max;
	int max_index = 0;

	cout << " Please Enter Integers " << endl;
	cin >> numbers;
	max = numbers;
	while (numbers != -999)
	{

		fmax.push_back(numbers);
		if (numbers>max)
		{
			max_index = count;
			max = numbers;
		}
		cout << "Enter numbers "
			<< (count + 1) << ":";
		cin >> numbers;
		count++;
	}





	cout << "The Maximum Value Is: " << max << endl;

	cout << "This Is element Number " << max_index << " In The list of Numbers" << endl;
	system("pause");
	return 0;
}
Topic archived. No new replies allowed.