Question: Working with the cin Statement Bring in the program bill.cpp from the Lab 3 folder. Exercise 1 : Complete the program so that a sample

Working with the cin Statement Bring in the program bill.cpp from the Lab 3 folder. Exercise 1 : Complete the program so that a sample run inputting 22 for the number of items bought and 10.98 for the price of each item will produce the results below.

Sample run of the program.

Please input the number of items bought 22

Please input the price of each item 10.98

The total bill is $241.56

Once you have the program working, change the instruction: cout

Rerun the program with the same data given in Exercise 1 above and record your results. What do you think the fixed attribute in the cout statement does?

Now put the fixed attribute back in and change the instruction to make the precision 4. Rerun the program with the same data given in Exercise 1 and record your results. What do you think the setprecision() attribute in the cout statement does?

The attribute showpoint forces all floating point output to show a decimal point even if the values are whole numbers. In some environments this is done automatically

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!