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
What is the purpose of citations?
Elina [12.6K]

Answer: Citiations areto show where you got information from.

Explanation:

6 0
3 years ago
Describe the function of the user account section of the control panel
cluponka [151]
From Google:

"User Account Control<span> or </span>UAC<span> for short is a security feature of Windows which helps prevent unauthorized changes to the operating system. These changes can be initiated by applications, users, viruses or other forms of malware."</span>
6 0
3 years ago
Which of the following cannot be created using Word software?
Arturiano [62]
3-database of new clients
7 0
3 years ago
Match the job roles with their appropriate qualifications
UNO [17]
Knowledge...- software QA engineer
Master’s...- business analyst
course...- network and computer admin
training...- multimedia artist
3 0
3 years ago
True or False: F Layout is better for users who read left to right, but layout is better for users who read right to left.
ipn [44]

Answer:

false

Explanation:

it depends on the user

5 0
2 years ago
Other questions:
  • Identify the correct software or hardware applications in the passage below
    10·1 answer
  • If you are a driver under 21 with a breath or blood alcohol level of ____ or higher, you will be required to attend a substance
    11·2 answers
  • Your grandmother was an established artist and left you several original paintings after she died. Which of these statements is
    6·1 answer
  • Marissa bought 2 and 1/2 gallons of orange juice to make punch how many quarts of orange juice did Marissa Buy
    15·2 answers
  • Your friend Suzy calls to ask for help with her computer. She says when she first turns on the computer, she doesn’t hear a spin
    10·1 answer
  • You load an image file into a numpy array and look at its shape, which is (433, 650). What does this indicate?
    13·1 answer
  • Alexandria works for a non-profit company that asks for donations to help the homeless people in her community. Recently the dat
    12·1 answer
  • Which memory can be removed from motherboard? RAM OR ROM?​
    11·1 answer
  • What is the role of the memory in a computer ​
    11·1 answer
  • Which statement correctly differentiates how to use list and table styles?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!