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
What is centripetal force that allows a car to move around a sharp curve in a roadway?
Ulleksa [173]
<span> The centripetal force that allows a car to move around a sharp curve in a roadway is the frictional force between the tires of its wheels and the surface of the road. </span>
7 0
3 years ago
FLUKE
Thepotemich [5.8K]

Answer:

cant understand anything

Explanation:

3 0
3 years ago
What two things does light provide?
labwork [276]

Answer:

Light provides brightness to see and also light carries energy

5 0
3 years ago
How will minerals orient when a rock is put under normal stress?
Radda [10]

Answer:

perpendicular to the direction of the greatest stress

4 0
4 years ago
See the diagram above. Which of the following is the best prediction of what would happen if you increased the distance in secti
Inessa [10]

By the definition of wavelength, the answer is the letter D, the wavelength would decrease.

We can see in the diagram a wave motion.

A wave has some characteristics:

  • Has an amplitude, the distance from 0 to the crest (highest point in the y-direction, point (3) in the figure) it would see in the figure as (2)
  • Has wavelength, the distance between the crests.
  • Has a trough, the lowest point in the y-direction.

Now, if we increase the distance of the crests, by the definition shown above, we will increase the wavelength.

Therefore, the answer is letter D, the wavelength would increase.

You can learn more about wave motion here:  

brainly.com/question/22763521

7 0
3 years ago
Other questions:
  • The charger for your electronic devices is a transformer. Suppose a 60 HzHz outlet voltage of 120 VV needs to be reduced to a de
    15·1 answer
  • A flowerpot falls off a windowsill and falls past the window below. You may ignore air resistance. It takes the pot 0.380 ss to
    7·1 answer
  • How do acids taste?<br><br> A. Sweet<br> B. Soapy<br> C. Bitter<br> D. Sour
    15·2 answers
  • A bus accelerated at 1.8 m/s2 from rest for 15 s. It then traveled at constant speed for 25 s, after which it slowed to a stop w
    15·1 answer
  • If you were to descend 100 m below the surface of the ocean, you would be in _____.
    8·2 answers
  • Which of the following is the most appropriate definition of organic compound?
    9·2 answers
  • Which point on the wave diagram below are 90° out of phase with each other?
    12·2 answers
  • Pls help quick too.................
    15·1 answer
  • What evidence do we have that the moon is receding from Earth?
    14·1 answer
  • An electron moves through a region of crossed electric and magnetic fields. The electric field E = 3059 V/m and is directed stra
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!