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 evidence did wegener have to support his theory of plate tectonics?
PSYCHO15rus [73]

Answer:

Wegener first thought of this idea by noticing that the different large landmasses of the Earth almost fit together like a jigsaw puzzle. The continental shelf of the Americas fits closely to Africa and Europe, and other continents showed the same trend. Wegner also analyzed both sides of the Atlantic Ocean for rock type, geological structures and fossils and noticed that there was a significant similarity between matching sides of the continents, especially in fossil plants.

8 0
3 years ago
Why is an object's density expressed as a relationship between two units?
vfiekz [6]
Probably for kind of the same reason that speed is expressed as a
relationship between two units.  You know, like miles per hour .

I guess the only reason is because no single unit has been invented
to describe density.

The rate of doing work or using energy would always be expressed
as a relationship between two units ... we would say that the rate of
work is "(so many) joules per second".  But the "watt" was invented,
so we can say "(so many) watts" instead.

So I guess you're right.  Density could be simpler to describe
if we only had a unit for it.  Then we wouldn't have to say "(so many)
grams per cubic centimeter".  We would just say "(so many) (new unit)".

Let's try it out:
 
"Uhhh, pardon me Professor . . . I've been working late in the lab,
and I believe I've identified a new substance, hitherto unknown to
the scientific community, and totally unexpected.  In its pure form,
the substance appears to be pink, it smells like butterscotch, and
its density is approximately 27.4 Brianas.  I think it's time we published
these findings ... with your name as lead investigator, of course."

I like it !
5 0
4 years ago
Which is better, ramen, or spaghetti
Sergio039 [100]

Answer:

ramen

Explanation:

7 0
3 years ago
Read 2 more answers
Show the weight of the ladder and draw the missing Frictional force.
madreJ [45]
Since there is no friction between the ladder and the wall, there can be no vertical force component. That's the tricky part ;)

So to find the weight, divide the 100N <em>normal</em> force by earths gravitational acceleration, 9.8m/s^2

W =  \frac{N}{g}  =  \frac{100N}{9.8m/s^{2}} =  \frac{100}{9.8} = 10.2kg


Then;
Draw an arrow at the base of the ladder pointing towards the wall with a value of 30N, to show the frictional force.
5 0
3 years ago
A speaker vibrates at a frequency of 200 Hz. What is its period
Daniel [21]
Period,  T = 1/ f.
f = frequency =  200 Hz.

Period T =  1/200 =  0.005 seconds.
8 0
3 years ago
Other questions:
  • you slide abox of books at constant speed up a30 degree ramp, applying a force of 200 newtons directed up the slope. The coeffic
    13·1 answer
  • Help with these questions thank you
    6·1 answer
  • Are passing through optical Centre deviate why ​
    9·1 answer
  • g If the x-component of a force vector is 5.69 newtons and its y-component is 8.00 newtons, then what is its magnitude?
    8·2 answers
  • A hydrogen line in a star's spectrum
    9·1 answer
  • The downsprue leading into the runner of a certain mold has a length of 175 mm. The cross-sectional area at the base of the spru
    14·1 answer
  • Choose whether each of the following statements is true or false
    10·1 answer
  • Why are paperclips attracted to magnets? Group of answer choices They contain silver They contain aluminum They contain tin They
    11·1 answer
  • What is happening in the first part of this picture?
    13·1 answer
  • Milk being heated on top of a stove will do what?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!