C++ program  Create program and prompt me to enter a dollar amount between 0 and 999.99999 as a C-string or X to exit. Loop unit I enter X to exit. Use a C-string for the input amount and related method processing. Review section 10.4. This implies you will have the following: #include     #include may be needed in Visual Studio, but still use C-String functions. Create a method that will use the functions described in Chapter 10. It is OK to use a globally defined char array. You must call this method to produce the formatted results. The program must modify or build a C-String in this format. Display the C-String created.  1. Include leading $ sign. 2. Must have a single decimal point with 2 digits after the decimal. If the amount had extra digits, then the result is a truncated value.  100.99 =   $100.99 150.00999 =    $150.00 50 = $50.00 48.1 = $48.10 This program is not simple. This exercise will help you understand some of the limitations of C-Strings. Do not process as string and then convert to C-String.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ program 

Create program and prompt me to enter a dollar amount between 0 and 999.99999 as a C-string or X to exit. Loop unit I enter X to exit.

Use a C-string for the input amount and related method processing. Review section 10.4. This implies you will have the following:

#include <cstring>   

#include <string> may be needed in Visual Studio, but still use C-String functions.

Create a method that will use the functions described in Chapter 10. It is OK to use a globally defined char array. You must call this method to produce the formatted results. The program must modify or build a C-String in this format. Display the C-String created. 

1. Include leading $ sign.

2. Must have a single decimal point with 2 digits after the decimal. If the amount had extra digits, then the result is a truncated value.

 100.99 =   $100.99 150.00999 =    $150.00
50 = $50.00
48.1 = $48.10

This program is not simple. This exercise will help you understand some of the limitations of C-Strings.
Do not process as string and then convert to C-String.

Expert Solution
Step 1

C++ is an efficacious general-purpose programming language. It can be used to elaborate on operating systems, browsers, games, and so on. C++ supports different ways of programming like procedural, object-oriented, functional, and so on. This makes C++ convincing as well as adaptable.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education