Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this C++ program please! Problem 1. Fill in the missing code such that the recursive function DisplayDigits will display the digits
I need help with this C++ program please!
Problem 1. Fill in the missing code such that the recursive function DisplayDigits will display the digits within an integer in reverse order Hint: 2593 % 1 0 gives you the right-most digit 3 2593 / 10 gives you 259 259 % 10 gives you the right-most digit 9 259/10 gives you 25 25 % 10 gives you 5 the right-most digit 25 10 gives you 2 2 % 10 gives you 2 2/10 give you 0 time to stop DO NOT USE ANY LOOPS, USE RECURSION Problem 2. Fill in the missing code to complete the recursive isPalindrome function. A string is a palindrome if the string is spelled the same forwards as backwards. A string that only contains one character is automatically a palindrome. A string that contains two characters is a palindrome if both of those characters are the same. Determining if a string is a palindrome can be solved recursively. Consider the string evilolive. Assume that variable first holds the subscript of the first letter and variable last holds the subscript of the last element of the string. If the characters stored at first and last are the same, then we move first up by 1 and last down by 1 (towards the center of the string). If the characters at first and last are NOT the same, then we know the string is not a palindrome. Fill in the function isPalindrome that returns true if a string passed as an argument is a palindrome and false otherwise. The function should be implemented recursively. The header for the function is below: bool isPalindrome (string s, int first, int last)/ YOU MUST USE RECURSION AND NO LOOPS TO RECEIVE ANY CREDIT 1 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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