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
A billiard ball of mass 0.28 kg hits a second, identical ball at a speed of 7.2 m/s and comes to rest as the second ball flies o
Strike441 [17]

Answer:

(a) -8064 N

(b) 8064 N

Explanation:

(a)

From Newton’s law of motion, Force, F=ma where m is mass and a is acceleration.

Since acceleration is the rate of change of velocity per unit time, then where v is velocity and the subscripts f and I denote final and initial

For the first ball, the mass is 0.28 Kg, final velocity is zero since it finally comes to rest, t is 0.00025 s and initial velocity is given as 7.2 s. Substituting these values we obtain

F=0.28\times \frac {0-7.2}{0.00025}=-8064 N

(b)

For the second ball, the mass is also 0.28 Kg but its initial velocity is taken as zero, the final velocity of the second ball will be equal to the initial velocity of the second ball, that is 7.2 m/s and the time is also same, 0.00025 s. By substitution

F=0.28\times \frac {7.2-0}{0.00025}=8064 N

Here, we prove that action and reaction are equal and opposite

3 0
3 years ago
Please help me with this question​
Oksanka [162]

Car at rest:

velocity= 0m/s

Acceleration:

0.2m/s²

Since total time:

3 min = 180s

Formula of acceleration:

acceleration = [final velocity - initial velocity] ÷ [total time]

Velocity at end:

0.2m/s² = [final velocity - 0m/s] ÷ [180s]

0.2m/s² × 180s = [final velocity]

[final velocity] = 36m/s

Distance travelled:

Velocity = displacement(distance) ÷ time

36m/s = displacement(distance) ÷ 180s

displacement(distance) = 36m/s × 180s

displacement(distance) = 6480m

<em><u>Hey I'm sorry but i do not understand why the answer on your worksheet for distance travelled is 3240m... its </u></em><em><u>half</u></em><em><u> of what my answer is...</u></em>

6 0
3 years ago
2 Polnis
Marta_Voda [28]

Answer:

Oprion A

The length of time over which the conditions are measured

Explanation:

Weather captures the daily atmospheric conditions over a short duration hence it is short-term. Climate is the average of weather and covers a longer duration hence long-term. Therefore, what differentiatea these two is the length of time over which the conditions are measured.

7 0
3 years ago
Climates on Earth get _____ as you move from the equator to the poles.
andreev551 [17]
The correct answer that would best complete the given statement above would be the last option: COLDER. Climates on Earth get colder <span>as you move from the equator to the poles. The places that are located near or on the equator experience the warmest or the hottest climates such as Africa. Hope this answer helps. </span>
5 0
3 years ago
Read 2 more answers
What is the domain theory of ferromagnetism?
Margaret [11]
A region within a magnetic material in which magnetization is in a uniform direction this means the individual magnetic moments of the atoms are aligned with one another and they point the same direction. when cooled bwlow a temperature called the curie temperature the magnetization of a piece of ferromagnetic material.<span />
5 0
3 years ago
Other questions:
  • A ball is attached to the end of a massless string. A circus clown twirls the string with a pulling force of 12 N, and the ball
    11·2 answers
  • Hows does the world spin and we cant feel it
    15·2 answers
  • Michael Faraday has a unit of electricity named after him. It is called the Mic and it measures the size of certain electrical c
    9·1 answer
  • A rock falls from a tower that is 320 feet high. As it is​ falling, its height is given by the formula h equals 320 minus 16 t s
    15·1 answer
  • Adding heat to matter causes the atoms to _____.
    9·1 answer
  • CHEGG In the final stages of production, a pharmaceutical is sterilized by heating it from 25 to 75C as it moves at 0.2 m/s thro
    10·1 answer
  • . The average human walks at a speed of 5 km per hour. If your PE teacher asks you to walk for 30 minutes in
    9·1 answer
  • A 60-kg passenger is in an elevator which is initially at rest. The elevator starts to travel downward. It reaches a downward sp
    11·1 answer
  • What tool would you use for Volume
    9·2 answers
  • In an rlc ac circuit, the values of the inductance and capacitance are both doubled. as a result of this change, the resonance f
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!