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
Nataly_w [17]
3 years ago
14

.3.3: Populating a vector with a for loop. Write a for loop to populate vector userGuesses with NUM_GUESSES integers. Read integ

ers using cin. Ex: If NUM_GUESSES is 3 and user enters 9 5 2, then userGuesses is {9, 5, 2}
Physics
1 answer:
Reptile [31]3 years ago
8 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

int main() {

  const int NUM_GUESSES = 3;

  vector<int> userGuesses(NUM_GUESSES);

  int i = 0;

int uGuess = 0;

for(i = 0; i <= userGuesses.size() - 1; i++){

 cin >> uGuess;

 userGuesses.at(i) = uGuess;

}

cout << endl;

  return 0;

}

Explanation:

First inbuilt library were imported. Then inside the main( ) function, 3 was assigned to NUM_GUESSES meaning the user is to guess 3 numbers. Next, a vector was defined with a size of NUM_GUESSES.

Then a for-loop is use to receive user guess via cin and each guess is assigned to the vector.

You might be interested in
I need help with number 2 pls it’s a quiz grade
Eduardwww [97]
2 is correct hope you get it right
8 0
3 years ago
How does lemon produce electricity
oksian1 [2.3K]

Answer:

Below!

Explanation:

The citric acid in the lemon acts as an electrolyte, a solution that conducts electricity. The zinc nail sheds electrons as electrically charged ions into the acid (a process called “Oxidation” because the material loses electrons). ... The average lemon output is . 9 volts at .

5 0
2 years ago
If a galaxy is located 200 million light years from Earth, what can you conclude about
timofeeve [1]

Answer:

D

Explanation:

It's quite simple actually, you see, what light years basically means is how many years light takes to travel from point a to point b. So here it says that a galaxy is 200 million light years away. So since that light is 200 million years away, it would take 200 million years until that light reaches us.

5 0
3 years ago
solve the following system by any method 2x - 6y = 24 ... -5x + 6y = -6 ... A. (0,-6) B. (4,-1) C. (-6,-6) D. (6,-1)
vodka [1.7K]
Using elimination, the answer is C. 
5 0
4 years ago
A 5 kg book falls from a shelf. If it lands at a speed of 5.7 m/s, from what height did it fall?
Pachacha [2.7K]

Answer:

57m

Explanation:

speed = 5.7m/s

or 57/10 m/s

so definitely the time taken will be 10 secs

so speed = distance/time taken

5.7= distance/10

distance = 5.7× 10

Distance = 57m

7 0
3 years ago
Other questions:
  • A constant force = 2.00 n + 3.00 n acts on a 5.00 kg object as it moves in a straight line from the position1 = 1.00 m + 1.00 m
    10·1 answer
  • If you were trying to describe the difference between power and work you could say...?
    9·1 answer
  • Which of the following best describes the movement of an object at rest if no outside forces act on it
    15·1 answer
  • A 2​-liter ​[l] soda​ bottle, made of​ pet, will fail at approximately 207 ​pound-force per square inch​ [psi] of pressure. if y
    7·1 answer
  • n object is undergoing uniform circular motion. Which of the following is/are true? I. The object is moving at constant velocity
    6·1 answer
  • Which best describes the electromagnetic force?
    10·2 answers
  • A 1,000 kg car uses a braking force of 10,000 N to stop in 2s. What impulse acts on the car?
    13·1 answer
  • A 200g air-track glider is attached to a spring. The glider is pushed in 10cm and released. A student with a stopwatch finds tha
    9·1 answer
  • Most interstellar clouds are: Most interstellar clouds are: much bigger than our solar system. similar in size to clouds in Eart
    14·1 answer
  • A "sound" is different than a "sound wave"
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!