1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
4vir4ik [10]
4 years ago
7

Write a for loop to populate vector userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and

user enters 9 5 2, then userGuesses is {9, 5, 2}.
Computers and Technology
2 answers:
Tanzania [10]4 years ago
8 0
#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);
  }
}
earnstyle [38]4 years ago
8 0

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

You might be interested in
Which of the following is a way the operating system prevents unknown or unauthorized users from accessing the system?
Xelga [282]

Put a code or security system on or a very secure password

Hope this helps...

6 0
3 years ago
Read 2 more answers
What do we call exceptions to the exclusive rights of copyright law?
Studentka2010 [4]

Answer:

Fair use

Explanation:

I don't know if this is correct but Its the best option.

4 0
3 years ago
Which of these is a historic real-world simulation game?
harkovskaia [24]

Answer:

B. Archery

Explanation:

the art, practice, or skill of shooting with bow and arrow

7 0
3 years ago
Adding _____ will allow the user to create text as it will often appear in publications with multiple articles, such as a newspa
mart [117]
Does applications make sense <span />
5 0
3 years ago
Read 2 more answers
The sum of these 9 numbers is 36. 2, 2, 6, 2, 1, 8, 7, 5, 3 What is the mean of these 9 numbers?
fiasKO [112]

Answer:

4

Explanation:

The mean is the sum divided by the count of numbers, so 36/9 = 4

6 0
2 years ago
Read 2 more answers
Other questions:
  • What color model should Joe use if he will be using an offset printing press?
    7·1 answer
  • How many shared keys are required for a company of 70 employees who all need to communicate securely with each other?
    13·1 answer
  • Suppose you have an int variable called number. What Java expression produces the second-to-last digit of the number (the 10s pl
    13·1 answer
  • True or False: It is illegal to park in a location that you block or create a hazard for other vehicles.
    11·2 answers
  • 2.1. The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. F
    10·1 answer
  • For an machine using 2-dimensional even parity for error detection/correction, and the following received bytes, where is the er
    9·1 answer
  • When addictions escalate and the individual loses his or her job or drops out of school, _______________.
    12·2 answers
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • ANYBODY WANNA PLAY FoRnITe
    11·2 answers
  • 14. Which of the following is NOT a
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!