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
ch4aika [34]
4 years ago
7

.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:
Ipatiy [6.2K]4 years ago
3 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
Craig Terrill has many _________. Press enter to interact with the item, and press tab button or down arrow until reaching the S
iren2701 [21]

Answer:

is there anything that is a hint? like a picture or a story?

Explanation:

7 0
3 years ago
Where is most of the mass of an atom located? in the nucleus in the orbits in the electrons it is split between the nucleus and
yulyashka [42]
Most of the mass is located in the nucleus as suggested by Rutherford's gold foil experiment.
7 0
4 years ago
Read 2 more answers
Changing the length of an air column will alter its _______
bija089 [108]
Natural Frequency 
Hope that helped!
8 0
3 years ago
Read 2 more answers
What is ONE variable that will change the amount of POTENTIAL ENERGY<br> of a box on the floor?
11111nata11111 [884]

Answer:

The height or the mass

Explanation:

The one variable that can change the potential energy of a box on the floor is either the height or the mass of the box.

Potential energy is the energy due to the position of a body.

Mathematically;

  Potential energy  = mass x acceleration due to gravity x height

Therefore, if the mass of the box is changed, the potential energy changes also.

If the position of the box is changed by raising it up, the potential energy changes

7 0
3 years ago
Question 12 (Mandatory) (5 points)
sergij07 [2.7K]
F = ma
F = (6kg) (3.5m/s2)
F = 21 N
7 0
3 years ago
Other questions:
  • Your environment can play a role in whether or not a specific gene is expressed
    10·2 answers
  • a 46 kilogram student climbs 11 meter up a rope at a constant speed if the student power output is 230 watts how long in seconds
    11·1 answer
  • . A projectile of mass 2 kg is fired with a speed of 20 m/s at an angle of 30° with respect to the horizontal. (a) Calculate the
    13·1 answer
  • What can be said about the sign of the work done by the force f⃗ 1??
    9·1 answer
  • WILL MARK BRAINLIEST!!!!
    11·1 answer
  • For every force an object applies, there is an equal and
    10·1 answer
  • When Beakman lets go of Liza and she starts moving her stored _____ changed into ____ energy.
    9·1 answer
  • Which imaging technique uses x-rays to make cross-sectional images of the body? mri ct scan x-ray imaging ultrasound
    11·1 answer
  • A certain ellipse has a semimajor axis with a length of 6.25 cm, and the
    7·1 answer
  • Are the acceleration and force vectors related? does the simulation show this relation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!