Question: More C-Strings. Write a program that will accept a monetary amount from 0.00 to 11.99. This can be a float value . Pass it to

More C-Strings.

Write a program that will accept a monetary amount from 0.00 to 11.99. This can be a float value . Pass it to a method that will generate the "Check Book" or Text version of the number and generate a C-String result. Display the value of the generated C-String. Loop unit I enter X to exit. Note you do not need to code for 100s or 1000s - only up to eleven dollars.

Create a C-string for the output amount and use C-string related methods for processing. This implies you will have the following:

#include

#include

You may need to create additional methods. That is your choice.

Example actions: Entering 8.51 displays "Eight dollars and 51 cents" built as a C-String.
Entering 9.12 displays "Nine dollars and 12 cents" I will not deduct for stating "One dollars" or "1 cents" as plural as I did in the Week 1 assignment. 

This snippet may help:

 float myMoney;
 cin >> myMoney; int singles = int(myMoney);

int cents = int(round(100.00 * (myMoney - singles))); string centsS = to_string(cents); // string allowed for data conversion from int. Do not use to string to build the result.

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!