[Solved] CSE1342 LabQuiz 4

$25

File Name: CSE1342_LabQuiz_4.zip
File Size: 160.14 KB

SKU: [Solved] CSE1342 LabQuiz 4 Category: Tag:
5/5 - (1 vote)

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 10 gives the right-most digit 3 2593 / 10 gives you 259 259 10 gives you the right-most digit 9

trine

s 5 the

2 10 gives you 2

2 / I O give you O

time to stop

DO NOT USE ANY LOOPS USE RECURSION

Problem 2, Fill in the missing code to complete the recursive isPaIindrome 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 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 isPaIindrome 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

YOU MUST USE RECURSION AND NO LOOPS TO RECEIVE ANY CREDIT

6.10.1: LabQuiz4

8 int

9 int

string astrng;

five digit number

  • enter

cout end

-enter a strinz

encl;

astring;

0/10

Load default template

main.cpp

endl;

if (flu)

else

Develop mode

is not

Submit mode

Run your program as often as youd like, before submitting for gradinq Below. type any needed

input values in the first box. then click Run program and observe the programs output in the

second box.

Enter program input (optional)

It your code requires input values. provide them here.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE1342 LabQuiz 4
$25