|
|
back to boardCould you please say how does the 4th test look like? Posted by ata_tnu 24 Jun 2008 16:05 I already don't know what to do, because I think that my prog works okay for all possible and impossible test cases. Please, consider the source code: (If the 'ended' logical principle is removed, it fails on the 2nd test) int main(void) { int i, ended = 1; char last, blonde[MAXBUF]; while (gets(blonde)) { if (!blonde[0]) continue; for (i = 0; !isalpha(blonde[i]); i++) ; if (!ended) blonde[i] = tolower(blonde[i]); else blonde[i] = toupper(blonde[i]); for (++i; blonde[i] != '\0'; i++) { if (isalpha(blonde[i])) blonde[i] = tolower(blonde[i]); else if (blonde[i] == '.' || blonde[i] == '!' || blonde[i] == '?') { while (!isalpha(blonde[++i])) ; blonde[i] = toupper(blonde[i]); } } puts(blonde); last = strlen(blonde) - 1; if (blonde[last] == '.' || blonde[last] == '!' || blonde[last] == '?') ended = 1; else ended = 0; } return 0; } |
|
|