I want to check if there is a ' ' after every '?', '!', and '.'. If there isnt i shall correct it by putting a ' '.
In this case it removes ? ! . instead and replaces it with a ' '. Cant find the problem.
I hope you understand.
Code:#include <stdio.h> #include <stdlib.h> #define MAX 1000 int main() { char text[MAX]; int i, j, end; fgets(text, MAX, stdin); i = strlen(text); end = i-1; for (j=0; j<end; j++){ if(text[j] == '.' || text[j] == '?' || text[j] == '!'){ if (text[j+1] != ' '){ putchar(' '); } } else { putchar(text[j]); } } return 0; }



LinkBack URL
About LinkBacks




