Respuesta :

Seprum
#include <iostream>
#include <vector>

#define NUM_GUESSES 3

int main()
{
  std::vector<int> userGuesses;
  for (int i = 0, input; i < NUM_GUESSES; i++)
  {
    std::cin >> input;
    userGuesses.push_back(input);
  }
}

Answer:

The solution code is written in C++.

  1.    vector<int> userGuesses;
  2.    int NUM_GUESSES = 3;
  3.    
  4.    int i;
  5.    int inputNum;
  6.    
  7.    for(i = 1; i <= NUM_GUESSES; i++){
  8.        cin>>inputNum;
  9.        userGuesses.push_back(inputNum);
  10.    }

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).

ACCESS MORE