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
Hello, PLEASE ANSWER ASAP!!! Don't report my question or give me false answers but I'm freaking out. I was biking home from scho
kodGreya [7K]

Answer:

just calmly talk and get money to pay them the bike and explain it to them

Explanation:

4 0
3 years ago
A boy whirls a stone in a horizontal circle of radius 1.4 m and at height 1.5 m above ground level. The string breaks, and the s
balandron [24]

Answer:233.23 m/s^2

Explanation:

Given

radius of circle=1.4 m

Height of stone above ground=1.5 m

Horizontal distance(R)=10 m

It is given at the time of break stone flies horizontally thus stone to cover a height of 1.5 m in time t before reaching ground

1.5=0+\frac{gt^2}{2}

t=0.55 s

Initial horizontal velocity at the time of break is given by u

R=u\times t

10=u\times 0.55

u=18.07 m/s

Therefore magnitude of centripetal acceleration is given by

a_c=\frac{u^2}{r}=\frac{18.07^2}{1.4}=233.23 m/s^2

6 0
3 years ago
Two 8.0 Ω lightbulbs are connected in a 12 V parallel circuit. What is the power of both glowing bulbs?
kati45 [8]

Answer:

96w

Explanation:

p=Iv..where v=12 and I=8.0

8 0
2 years ago
S waves arrive at distant points before other seismic waves, true or false
Step2247 [10]
False. p waves, than s waves
3 0
3 years ago
What atmospheric conditions can cause sound wave refractions similar to those observed in the ocean?
Romashka-Z-Leto [24]
It has to do with we're the water is coming from and we're it's at like city or town
4 0
3 years ago
Other questions:
  • Why would knowing the characteristics of circuits be important in designing electrical circuits?
    9·2 answers
  • Nuclear chain reactions within power plants do NOT produce bomb-like explosions primarily because the ________.
    12·1 answer
  • Two stationary point charges of 3.00 nC and 2.00 nC are separated by a distance of 50.0 cm. An electron is released from rest at
    7·1 answer
  • If an engine has a compression ratio of 7:1,
    7·2 answers
  • If the equation on the board had shown 3 atoms of carbon on the reactants side, how many atoms of carbon would need to be repres
    10·2 answers
  • An ideal monatomic gas at temperature T is held in a container. If the gas is compressed isothermally, that is at constant tempe
    8·1 answer
  • The main difference between a chest and a bounce pass is what?
    12·2 answers
  • Identify a source of microwaves
    15·2 answers
  • Guys pls thi is my last pointa just answer this!!!!(WILL GIVE BRAINLY) A student takes apart a wooden box. What can they build w
    15·1 answer
  • Will give correct answer brainliest
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!