Question: In the lecture, you worked on the toDollars function which formats a number in the form $ 1 , 2 3 4 . 2 5

In the lecture, you worked on the toDollars function which formats a number in the form $ 1,234.25. Write a more generalized format() function that works like this:
double amt =1234.25;
cout << format(amount); // default formatting
cout << format(amount,.2); // fixed, 2 decimals
cout << format(amount,12.2); // width 12, fixed, 2 decimals
cout << format(amount,12.2,""); // width 12, fixed, 2 decimals, Euro

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 Databases Questions!