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
Rasek [7]
2 years ago
7

Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed

<< setprecision(2); once before all other cout statements. (1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in a vector of doubles. Output the vector's numbers on one line, each number followed by one space. (2 pts)
Computers and Technology
1 answer:
Fofino [41]2 years ago
5 0

Answer:

In C++:

#include <iomanip>

#include <iostream>

#include <vector>

using namespace std;

int main(){

vector<double> myvector;

double userinput;

cout<<"Enter 5 numbers: ";

for (int i = 1; i <= 5; i++){

 cin>>userinput;

    myvector.push_back(userinput);

}

for (int i = 0; i < 5; i++){

    cout << fixed << setprecision(2)<< myvector.at(i) <<' ';

}

return 0;

}

Explanation:

This declares the vector as double

 vector<double> myvector;

This declares a variable for input as double

double userinput;

This prompts the user for input of 5 numbers

cout<<"Enter 5 numbers: ";

This iterates from 1 to 5

for (int i = 1; i <= 5; i++){

This gets each integer input

 cin>>userinput;

This pushes each input into the vector

    myvector.push_back(userinput); }

This iterates through the vector

for (int i = 0; i < 5; i++){

This prints each vector element separated by space using fixed setprecision

cout << fixed << setprecision(2)<< myvector.at(i) <<' ';

}

You might be interested in
Which workbook view is used most often in Excel?
horrorfan [7]

Answer:

Page layout

Explanation:

It is used the most!

4 0
2 years ago
Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, the
Savatey [412]

Answer:

what are the three different numbers?

8 0
2 years ago
How often should administrators and network users be required to change their password?
Sergeu [11.5K]
Once every 3 month's
8 0
3 years ago
What engine component is shown in the above Figure?
astra-53 [7]

send attached file with it


5 0
3 years ago
Read 2 more answers
WILL MARK BRAINLIEST.....
slamgirl [31]

Answer:

Variables. A variable is a way of naming and storing a value for later use by the program, ... its type, and optionally, setting an initial value (initializing the variable). ... byte x; x = 0; x = x - 1; // x now contains 255 - rolls over in neg. direction

Explanation:

7 0
3 years ago
Other questions:
  • What is the most consistent item regardless of the software used in BI?
    5·1 answer
  • Pinterest, a visual bookmarking Website, logs more than 14 terabytes of new data each day, which means its storage needs are con
    10·1 answer
  • What is the financial aspect for a business as to what database software they will buy?
    6·1 answer
  • Choose a project with a relatively simple description (building a LAN, designing a web page, inventing a new communication devic
    6·1 answer
  • What does it mean to be self demanding?
    12·1 answer
  • Why is there no I do you time of day when all students should study
    10·1 answer
  • What does it mean to say that data in an Excel table is “dynamically linked” to a chart? What are the advantages of this feature
    5·1 answer
  • Specific keys that each finger is responsible for typing is called A. ergonomics B. Touch typing C. Key reaches D. Posture
    8·1 answer
  • Name the first mechanical computer​
    11·1 answer
  • Describe the specific job you would want to have if you were going to pursue a career in digital music or video.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!