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
NEED ANSWER ASAP WILL MARK BRAINLIEST
lukranit [14]
Speed=30 m/s - 1.5 m/s = 28.5 m/s forward
7 0
3 years ago
___ is the combination of all colors of light
TiliK225 [7]
The color white is what you'd see when every color of light is combined.
5 0
3 years ago
Read 2 more answers
Write down short notes on:<br>c. Power​
Fudgin [204]

Answer: In the International System of Units, the unit of power is the watt, equal to one joule per second. In older works, power is sometimes called activity. Power is a scalar quantity.

Explanation: SI unit: watt (W)

In SI base units: kg⋅m2⋅s−3

Derivations from other quantities: P = E/t; P = F...

4 0
3 years ago
5. Dry ice is an example of _________, which is the process of a solid turning directly into a gas. (1 point) precipitation melt
ki77a [65]
<span>5. Dry ice is an example of _________, which is the process of a solid turning directly into a gas. (1 point)

sublimation


6. The ____ is a unit of force. (1 point)

</span>n<span>ewton

7. Which of the following is the boiling point of water? (1 point)
 
100°C 


8. Which of the following describes the molecular structure of water at 40°C? (1 point)

water molecules are close together and moving freely around each other </span>
6 0
3 years ago
You see a marble sign. Its letters are too worn to read. What caused this?
enyata [817]
It is called weathering. there are three different types of weathering, physical weathering, chemical weathering, and biological weathering. Your particular question is caused by chemical weathering. 
8 0
3 years ago
Other questions:
  • An airplane traveling from San Francisco northeast to Chicago travels 1260 km in 3.5 h. What is the airplanes average velocity?
    13·1 answer
  • In the realm of scientific inquiry, making an observation typically leads to ___.
    9·2 answers
  • Whereas the vast majority of astrophysicists support the big bang theory, many nonscientists consider the theory to be controver
    6·1 answer
  • A lightbulb has a resistance of 285 ω when operating with a potential difference of 110 v across it. what is the current in the
    5·1 answer
  • True or false. Lateral to the inguinal region is the coxal region, while superior to the scapular region is the dorsal region.
    14·1 answer
  • Astronomers are comparing two stars that are known to have the
    12·1 answer
  • Explain what happens as an object moves through each phase of matter.<br><br> ASAP PLEASE ????????
    6·1 answer
  • The ultrasound is reflected from the seafloor back to the submarine.
    10·1 answer
  • Sophia was studying with Maalik about the layers of the Earth. They were given several different statements about the layers. Wh
    12·2 answers
  • Velocity and acceleration are both vectors; they have a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!