Answer:
The solution code is written in C++.
- vector<int> userGuesses;
- int NUM_GUESSES = 3;
-
- int i;
- int inputNum;
-
- for(i = 1; i <= NUM_GUESSES; i++){
- cin>>inputNum;
- userGuesses.push_back(inputNum);
- }
Step-by-step explanation:
By presuming there is a vector, userGuesses and the NUM_GUESSES is 3 (Line 1 - 2).
Next we can create a for-loop that will run for NUM_GUESSES round of iterations. In each iteration, we use cin to get an input number and then use push_back method to add the input number to the userGuesses vector (Line 7 - 10).