Lab VI - COSC 215
Lab VI - COSC 215
Lab Session VI
Recursion
Sample input/output 1
Enter a: 2
Enter b: 3
2 to the power 3 = 8
Sample input/output 2
Enter a: 2
Enter b: -3
2 to the power -3 = 0.125
Sample input/output 1
Enter value: 29
29 is prime
Sample input/output 2
Enter a: 49
49 isn’t prime
Sample input/output:
Max of the first array: 9
Max of the second array: -2
2
Exercise 4: Palindrome
A palindrome is a word, number, phrase, or other sequence of symbols that reads the same
backwards as forwards, such as the words madam or Racecar, the date and time 12/21/33
12:21, and the sentence: "A man, a plan, a canal – Panama"
Develop a main function to test your function as showed in the following Input/Output sample.
Recall that, to read a string s with blanks, you need to use the function getline(cin, s).
To ignore the case of a letter (uppercase or lowercase) you can convert all uppercase letters to
lowercase letters by adding to them the value 32. For example, ‘A’ + 32 gives ‘a’.
Sample input/output
madam is a palindrome
Racecar is a palindrome
Thank you!