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 is the voltage in a circuit if the current is 6.2 A and the resistance is 18 ohms?
Nitella [24]
We already know the formula:
Voltage = Current * Resistance
In the given question, there are numerous information's that are already given.
Current = 6.2 A
Resistance = 18 ohms
Then
Voltage = 6.2 * 18 Volts
             = 111.6 Volt
So, the voltage in the circuit will be 111.6 volts. I hope it helps you.
4 0
3 years ago
What type of machine is used to measure the location of an earthquake epicenter.
Ber [7]

Answer:

Seismometer

Explanation:

Seismometer measures Earth quake epicenter while seismograph measures Earth quake size

8 0
2 years ago
A ship anchored at sea is rocked by waves that have crests 14 m apart the waves travel at 7.0 m/s how often do the wave crest re
xeze [42]

Answer:

I think its 2 seconds

Explanation:

14/7

3 0
3 years ago
A capacitor with initial charge q0 is discharged through a resistor. a) In terms of the time constant τ, how long is required fo
-BARSIC- [3]

Answer:

It would take \tau(\ln 9 - \ln 8) time for the capacitor to discharge from q_0 to \displaystyle \frac{8}{9} \, q_0.

It would take \tau(\ln 9 - \ln 7) time for the capacitor to discharge from q_0 to \displaystyle \frac{7}{9}\, q_0.

Note that \ln 9 = 2\,\ln 3, and that\ln 8 = 3\, \ln 2.

Explanation:

In an RC circuit, a capacitor is connected directly to a resistor. Let the time constant of this circuit is \tau, and the initial charge of the capacitor be q_0. Then at time t, the charge stored in the capacitor would be:

\displaystyle q(t) = q_0 \, e^{-t / \tau}.

<h3>a)</h3>

\displaystyle q(t) = \left(1 - \frac{1}{9}\right) \, q_0 = \frac{8}{9}\, q_0.

Apply the equation \displaystyle q(t) = q_0 \, e^{-t / \tau}:

\displaystyle \frac{8}{9}\, q_0 = q_0 \, e^{-t/\tau}.

The goal is to solve for t in terms of \tau. Rearrange the equation:

\displaystyle e^{-t/\tau} = \frac{8}{9}.

Take the natural logarithm of both sides:

\displaystyle \ln\, e^{-t/\tau} = \ln \frac{8}{9}.

\displaystyle -\frac{t}{\tau} = \ln 8 - \ln 9.

t = - \tau \, \left(\ln 8 - \ln 9\right) = \tau(\ln 9 - \ln 8).

<h3>b)</h3>

\displaystyle q(t) = \left(1 - \frac{1}{9}\right) \, q_0 = \frac{7}{9}\, q_0.

Apply the equation \displaystyle q(t) = q_0 \, e^{-t / \tau}:

\displaystyle \frac{7}{9}\, q_0 = q_0 \, e^{-t/\tau}.

The goal is to solve for t in terms of \tau. Rearrange the equation:

\displaystyle e^{-t/\tau} = \frac{7}{9}.

Take the natural logarithm of both sides:

\displaystyle \ln\, e^{-t/\tau} = \ln \frac{7}{9}.

\displaystyle -\frac{t}{\tau} = \ln 7 - \ln 9.

t = - \tau \, \left(\ln 7 - \ln 9\right) = \tau(\ln 9 - \ln 7).

7 0
3 years ago
Distinguish between friction force and motion?
Ksju [112]

Friction force is when you rub 2 things together and they get warm. Motion, on the other hand, is if your walking along the sidewalk - you hardly get warmer -------


Unless it's a colder day outside and you're walking SO you decide to rub your hands together to get warm, but if you were just walking , its motion and only motion - no friction :):)

6 0
3 years ago
Other questions:
  • A bimetallic strip consists of two metals: A on top and B at bottom. At temperature 00C this bimetallic strip was rigidly attach
    15·1 answer
  • Which of the following has more inertia: (a) a rubber ball and a stone of the same size? (b) a bicycle and a train? (c) a five-r
    15·2 answers
  • Which of the following is not a double-replacement?
    8·1 answer
  • An 88.0 kg spacewalking astronaut pushes off a 645 kg satellite, exerting a 110 N force for the 0.450 s it takes him to straight
    10·1 answer
  • Ondrea could drive a Jetson's flying car at a constant speed of 540.0 km/hr across oceans and space, approximately how long woul
    13·1 answer
  • . Solve the following problem using analytical techniques: Suppose you walk 18.0 m straight west and then 25.0 m straight north.
    7·1 answer
  • Which elements listed below are most likely to form anions? Select all that apply. Lithium (Li) Calcium (Ca) Sulfur (S) Fluorine
    11·1 answer
  • Please help!!! This Is for science
    11·1 answer
  • WILL AWARD OVER 50 POINTS TO WHOEVER ANSWERS FIRST
    8·1 answer
  • Help? 25 points and will give brainliest!
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!