Vector program

I need to write a program that reads 10 integers from the user and stores them in a vector, calculate the average of these 10 numbers and print the numbers in the vector that are less than or equal to the average. I am only looking for help with the first part, getting and storing the integers from the user. How do I ask for and store multiple variables in a vector?
Also, I am only allowed to use:

1
2
3
#include <iostream>
#include <vector>
using namespace std;
Last edited on
1
2
3
vector<int> vec;
int num;
while(cin >> num) vec.push_back(num);

Use CTRL-Z to break out of the loop.
Last edited on
Topic archived. No new replies allowed.