need to create a program that accepts an unknown number of integer values which then gets stored in a vector. When the user inputs “enough” then the program will output all the odd numbers in the integer list given by the user. the vector is checked in a while loop with a nested if. i got the concept but can't find a way to build the code for it.
the program has to work something like this.
input a number: 212
input a number: 2031
input a number: 13
input a number: 22
input a number: enough
int x=0,count=0;
cout << "input a number:" << endl;
while (cin >> x) { // checks if entered value is an integer
if (x % 2) { // if x is odd
// add x to vector;
count++
}
cout << "input a number:" << endl;
}
for (int i=0;i<count;i++)
print the vector element values;