Assignment: #NumberPlay |
Due: 05/06/2017 |
Points: 7 |

Write an interactive program that gets positive integer numbers as inputs and checks to see if those numbers are palindromic, repdigit, and undulating. The program also scrambles the digits of entered numbers.

Process inputs until the user enters 0.

If a non-integer is entered, print an error message and continue the loop (i.e. get the next input).

If a negative number is entered, print an error message and continue the loop (i.e. get the next input).

Important note: String objects cannot be used to determine if a number is a palindrome. In other words, this program must be implemented using an array of characters.

The program must be split into the following functions.

bool ispalindrome(char[]); Palindromic number equals itself when its digits are reversed. Examples: 101, 2112, 12321. Return true if the array contains a palindromic number; otherwise, return false. bool isrepdigit(char[]); The digits of a repdigit number are all the same. Repdigit numbers must have at least two digits. Examples: 22, 111, 444, 999999. Return true if the array contains a repdit number; otherwise, return false. bool isundulating(char []); An undulating number has the digit form aba, abab, ababa..., where a != b. Examples: 101, 121, 6969, 12121. Return true if the array contains an undulating number; otherwise, return false. int scramble(char[] orig, char[] new); convert odd digits into nothing convert 0 into a convert 2 into e convert 4 into i convert 6 into o convert 8 into u This function returns the length of the parameter char[] new.The following provides an example of how the program should interact with the user.

Enter a positive integer (0 to exit): <1228> 1228 is not a palindrome 1228 is not a repdigit 1228 is not undulating 1228 scrambled "eeu" (length 3) Enter a positive integer (0 to exit): <15851> 15851 is a palindrome 15851 is not a repdigit 15851 is not undulating 15851 scrambled "u" (length 1) Enter a positive integer (0 to exit): <hello> *** error: inputs must be an integer Enter a positive integer (0 to exit): <919> 919 is a palindrome 919 is not a repdigit 919 is undulating 919 scrambled "" (length 0) Enter a positive integer (0 to exit): <-99> *** error: inputs must be greater than zero Enter a positive integer (0 to exit): <4115> 4115 is not a palindrome 4115 is not a repdigit 4115 is not undulating 4115 scrambled "i" (length 1) Enter a positive integer (0 to exit): <2222> 2222 is a palindrome 2222 is a repdigit 2222 is not undulating 2222 scrambled "eeee" (length 4) Enter a positive integer (0 to exit): <74747> 74747 is a palindrome 74747 is not a repdigit 74747 is undulating 74747 scrambled "ii" (length 2) Enter a positive integer (0 to exit): <0>