Hi guys,
Im working on a palindrome program and the internet has been quite helpfull, I have been able to write a program that almost works as I want it to work. The only thing I'm struggling with is that capital letters are not the same as normal letters in ASCII.
I would like my program to be able to mark both 'mum' and 'Mum' as a palindrome.
This is my code for now :
Code:
#include <stdio.h>
#include <string.h>
int main() {
char palindroom[50];
int lengte, i;
int woord = 0;
printf("Enter a string:\t");
scanf("%s", palindroom);
lengte = strlen(palindroom);
for (i = 0; i < lengte; i++) {
if (palindroom[i] != palindroom[lengte - i - 1]) {
woord = 1;
break;
}
}
if (woord) {
printf("%s is not a palindrome", palindroom);
}
else {
printf("%s is a palindrome", palindroom);
}
getchar();
return 0;
}
not all words are English as you can read, that's Dutch but I think you'll understand.