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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started