I need help with this program.
Hint
Create a string variable (char str[80])
Convert the string to uppercase characters
Keep only the alphabetic characters.
Compare the first character with the last character. If they're are the same,
compare the next character.
I need to write a C++ Program that determines if a given string is a palindrome?
#include%26lt;stdio.h%26gt;
#include%26lt;string.h%26gt;
#define size 26
void main()
{
char strsrc[size];
char strtmp[size];
clrscr();
printf("\n Enter String:= "); gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string \"%s\" ispalindrome",strsrc);
else
printf("\n Entered string \"%s\" is not
palindrome",strsrc);
getch();
}
flamingo plant
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment