Palindromic Numbers Please hElp C++?
-
My new version codes are supposed to include these expressions and I dont know what to do// bool ispalindrome(char[]); Palindromic number equals itself when its digits are reversed. Examples: 101, 2112, 12321. 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. bool isundulating(char []); An undulating number has the digit form aba, abab, ababa..., where a != b. Examples: 101, 121, 6969, 12121. void 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 these are my codes please help// #include <iostream> #include<cstdlib> #include<cctype> #include<cstring> using namespace std; void Reverse(char name[]); int main(int, char**) { int EXIT_VALUE = 0; char strn[80]; char arr[80]; bool flag=false; do{ cout<<"Enter a positive integer ("<<EXIT_VALUE<<") to exit: "; cin>>strn; if(atoi(strn)<0){ cout<<"*** error: inputs must be greater than zero"<<endl<<endl; continue; }else if (!isdigit(strn[0])) { cout << "*** error: inputs must be an integer" << endl<<endl; continue; } strcpy(arr,strn); Reverse(arr); if(strcmp(arr,strn)==0) { flag=true; } if(flag){ cout<<strn<<" is a Palindrome"<<endl<<endl; }else{ cout<<strn<<" is not a Palindrome"<<endl<<endl; } flag=false; }while(strcmp("0",strn)!=0); return 0; } void Reverse(char name[]) { // get the length of the current word in the array index int nameLength = strlen(name)-1; for (int currentChar=0; currentChar < nameLength; --nameLength, ++currentChar) { // copy 1st letter in the array index into temp char temp = name[currentChar]; // copy last letter in the array index into the 1st array index name[currentChar] = name[nameLength]; // copy temp into last array index name[nameLength] = temp; } }
-
Answer:
I'm not exactly sure what it is you are asking... What is it that you don't understand? Based on what I see you look like you are on a roll, so where is the problem?
Lebron at Yahoo! Answers Visit the source
Related Q & A:
- Why cant i view my contacts display image? please help if you know ,thanks?Best solution by Yahoo! Answers
- The pores on my face are wideninf by the minute. Please help me so that I can have them the normal size?Best solution by Yahoo! Answers
- I cannot get the toolbar with my favorites to appear...please help.Best solution by Yahoo! Answers
- I did something really bad and now i need help please help me.Best solution by Yahoo! Answers
- Help with TV show, please help?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.