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]
3 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]3 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
"A file named numbers.txt contains an unknown number of lines, each consisting of a single integer. Write some code that compute
satela [25.4K]

Answer:

Following are the program in the Python Programming Language.

#declare variable and initialize to 0

sum = 0

#read the following file

file = open('numbers.txt', 'r')

#set the for loop

for n in file:

  #convert the file string into the integer and perform sum.

  sum += int(n)

Explanation:

<u>The following are the description of the program</u>.

  • Firstly, declare variable 'sum' and initialize the integer type value i.e., 0.
  • Set the variable 'file' that only read the following file text i.e., 'numbers.txt'.
  • Set the for loop that read the content of the file and store in the variable 'n' one by one.
  • Finally, er convert the following string in to the integer and perform the addition.
7 0
3 years ago
What are the different types database of end users? Discuss the main activi-ties of each
disa [49]

Answer:

following types of databases available in the market −

Centralised database.

Distributed database.

Personal database.

End-user database.

Commercial database.

NoSQL database.

Operational database.

Relational database.

Cloud database.

Object-oriented database.

Graph database

8 0
3 years ago
Read 2 more answers
Does any body like animal jam
cricket20 [7]

Answer:

Never used it so I do not know.

Explanation:

To be honest i thought you meant like animal jelly at first

7 0
4 years ago
Read 2 more answers
A company requires an Ethernet connection from the north end of its office building to the south end. The distance between conne
BlackZzzverrR [31]

Answer:

A company requires an Ethernet connection from the north end of its office building to the south end. The distance between connections is 161 meters and will need to provide speeds of up to 10 Gbps in full duplex mode. Which of the following cable combinations will meet these requirements?

ANSWER: Use multi-mode fiber optic cable

Explanation:

MULTI-MODE FIBER OPTIC CABLE

For Ethernet distances up to 100 meters, the Copper CATX cable will do just fine. In the question, we are dealing with a distance of up to 161 meters, so we need an Ethernet extension. LAN extension over fiber optic cable with media converter can be used to convert the Ethernet cable runs from copper to fiber. Multi-mode fiber has a range of 550 meters for 10/100/1000 Ethernet links.

Multi-mode optical fiber is commonly used for communication over short distances, like within a building or on a campus. They are capable of data rate of up to 100 Gbps, which surpasses the requirements in this question. They are more economical in this case as they are not as expensive a the single-mode optical fiber cable. Fiber optic cable has the advantage of being immune to electromagnetic interferences, spikes, ground loops, and surges. This makes it more suited for this purpose.

7 0
4 years ago
Astrid’s computer screen suddenly says that all files are now locked until money is transferred to a specific account, at which
monitta

Answer:

Your answer would likely be ii

Explanation:

Most of the time these types of programs will behave like the one stated. They normally want you to pay with Bitcoin but it can vary like with Ethereum or really anything that's in the stock market! But it normally consists of Bitcoin

6 0
3 years ago
Other questions:
  • How can my computer catch a virus?
    13·1 answer
  • Corey set up his presentation for delivery to his team. The information he had to convey was critical to their job performance.
    6·3 answers
  • The American Footwear and Apparel Group exerts pressure
    12·1 answer
  • Which description of the plain text file format is most accurate?
    10·1 answer
  • You've just purchased 10 new notebook systems for your users. You are concerned that users will leave the systems on for long pe
    10·1 answer
  • Nathan wants to create multiple worksheet containing common formatting styles for his team members. Which file extension helps h
    9·1 answer
  • Do most good businesses have to deal with conflict
    7·1 answer
  • Which of the following statements is true?A)Implicit data type conversion is performed when you mix values of different data typ
    5·1 answer
  • A small _____ at the lower right corner of a tool indicates that it contains hidden tools​
    13·2 answers
  • A combination of numbers and symbols used to express a calculation. Question 11 options: Formula Formula Bar Worksheet Workbook
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!