|
|
вернуться в форумWhy I got WA Please check my Program//Spell checker is created by MR.T Dtone Vorapong Suppakitpaisarn #include"stdio.h" #include"stdlib.h" #include"string.h" int main(void) { int statesmall=0,statecapital=1,count=0; char x; FILE *fp,*fp2; fp=stdin; fp2=stdout; while(!feof(fp)) { fscanf(fp,"%c",&x); if((x>='A')&&(x<='Z')&& (statecapital==0))
{count++;statesmall=1;} else if(x=='\n') statecapital=1; else if((x>='a')&&(x<='z') &&(statesmall==0))
{count++;statesmall=1;statecapital=0; } else if((x==',')||(x==';')|| (x==':')||(x=='-')||(x==' ')) statecapital=1; else if((x=='.')||(x=='!')|| (x=='?')) { statecapital=1; statesmall=0; } else if((x>='A')&& (x<='Z')) { statecapital=0; statesmall=1; } else if((x>='a')&& (x<='z')) { statecapital=0; statesmall=1; } } fprintf(fp2,"%d",count); return 0; } |
|
|