I want a working code in c++ with algorithm Design and create a C++ class to convert a string representing a positive integer or positive
I want a working code in c++ with algorithm
Design and create a C++ class to convert a string representing a positive integer or positive decimal value into the long int and double numeric types. If the string value represents a decimal value, the converted integer version will be truncated. If the string value represents an integer, the converted decimal value will have a decimal portion of zero.
Input Integer Decimal string conversion conversion
123 123 123.0
12.45 12 12.45
Your design must use a character stack class in your conversion. You may use two stacks for the conversion if you wish. Your stack class must be based on the integer stack class developed in class (see handout). Your convert to numeric class should have member functions for the following tasks: an overloaded constructor that accepts the string to convert a convert member function that accepts a string and returns a boolean success status a getIntValue member function that returns the converted value as a long int a getDecValue member function that returns the converted value as a double Create a driver program to demonstrate your class. The driver will prompt the user and accept a string representing a positive integer or decimal, then use your class to convert it. Finally, demonstrate the converted value is useable with any type specific operation, both as a long int and double.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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