#include <iostream> #include <vector> using namespace std; int choose() { cout << "Enter your choice, 1,2 or 3:\n"; int x; cin >> x; return x; } int main() { vector <int> vote; for(int i=0; i<10; ++i) { int choice = choose(); vote.push_back(choice); } cout << vote.size() << '\n'; }
1 2 3 1 2 1 2 3 1 2
Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: Enter your choice, 1,2 or 3: 10