Question: Problem 2 Write a program that prompts the user to enter two positive whole numbers as strings! Create a function that validates the input and

Problem 2 Write a program that prompts the user to enter two positive whole numbers as strings! Create a function that validates the input and returns true if all chars in the string are digits. Call the function from the main and prompt the user to re-enter if any invalid input was entered. Create a second function that converts the string to an int and returns it. The program then converts both strings to integers and computes and prints out the sum. string to int 10 points Hints: For example: 4127 can be split up as 4 1000 1 100 2 107'1 You can convert a char ch to an int by subtracting '0' from it: int num = (int ) ch- '0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
