Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions

Question

List the common indicators of stress.

Answered: 1 week ago