Question: Write a program that does the following: In certain programming stuations, such as getting information from web forms, via text boxes, the data coming in
In certain programming stuations, such as getting information from web forms, via text boxes, the data coming in may need to be numerical (we want to perform arithmetic on it), but it is stored in the form of a list of characters (the numerical value stored is based upon the table above). Therefore, as the programmer, we must convert the character to an integer digit or the string containing digits as characters to its decimal equivalent YOUR JOB: For this project, you will simulate this conversion. Your program will ask the user to enter a 4 digit numerical value. As the programmer, you will input the value as a string. You will devise an algorithm to convert the string of characters (string of digits) to a single integer, stored in a single integer value. At the end of this algorithm, you will print the addition (using the + operator) of the input string to itself, and the addition of the converted integer to itself For example, if the user were to input 9275, the outputs would be 18550 and 92759275 Program should generate appropriate error messages if the user enters: (1) less than 4 digits, (2) morethan 4 digits, or (3) any non-numeric digits Constands should be used in place of literals where appropriate No loops or atoi function C++ language. (cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
