Question
modify my program so the text in the result prints out the words eg the quick brown fox jumped over the lazy dog,its reverse like
modify my program so the text in the result prints out the words eg the quick brown fox jumped over the lazy dog,its reverse like god yzal eht revo depmuj xof nworb kciuq and that is not a palindrome
#include
for( i=0;i < length ;i++) { // Compare each character from first and last if(str[i] != str[length-i-1]) { // not palindrome flag = 1; } // write reverse string to file fputc(str[length-i-1], fileAddress); } fprintf(fileAddress, " "); if (flag) { // not palindrome return 0; } else { // palindrome return 1; } }
int main() { char s[count]; int n; remove("rs.txt"); fileAddress = fopen("rs.txt", "a"); printf("Just hit enter to start. "); do { while (getchar()!=' '); printf("Enter string: "); fgets(s, count, stdin); n = isPalindrome(s); if(n == 1) { printf(" Yes, %sis a palindrome. ", s); } else { printf(" No, %snot a palindrome ", s); }
printf("Do you still want to continue? "); printf("1=yes, 0= no "); scanf("%d",&n); while(!(n==0 || n==1)) { printf("\a"); scanf("%d",&n); } }while(n==1); fclose(fileAddress); _getch(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started