Question: Use C-Style strings to do the following: Write a function that will take a double as a parameter . The function output the number, formatting

Use C-Style strings to do the following:

Write a function that will take a "double" as a parameter. The function output the number, formatting it in the following way:

-If the number is negative, it will preface the number with a minus '-' sign

-If the number is a decimal with no digits to the left of the decimal point, it will include a '0' to the left of the decimal point

-The number will be shown with 4 digits to the right of the decimal point. Pad with zeros if necessare. For example: 4 -> 4.0000

-Commas will be place on the left side of the decimal point in their appropriate place. For example: 1,234,567.0000

-Write a main function that will prompt the user for a number then call the display function.

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!