Question: a ) Write a recursive function in C + + with the following prototype: int getWholeNumber ( string s ) ; The function should recognize
a Write a recursive function in with the following prototype:
int getWholeNumberstring s;
The function should recognize a possibly empty sequence of base digits and return the corresponding value as a nonnegative integer, or return if the string contains any nondigits. For the recursive case, call the function on ssubstr slength In the special case where is empty string, the function should return This can be your base case.
b Write a function int getIntegerstring s bool & isValid; that recognizes valid integers. That means a nonempty sequence of digits, possibly preceded by a single minus sign. If the string is not a valid integer, then the function should set isValid to false and return If the string is a valid integer then the function will set isValue to true and return the corresponding integer value. Your code should call getWholeNumber from Part
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
