after i execute the code by ./code
>i have entered a pragraph
>i have pressed Ctrl+Enter to denote EOF
>then a nothing happened i m supposed to see the results. the console keep on taking input,ie.condition in while got something wrong
>are there any syntax errors in program
my simple question is whats wrong with the code why am i unable to see results, why the loop is never endingCode://Code to count spaces and newlines and alpha a and A in a paracgraph #include<stdio.h> int main() { static int word,line,a,ca; char c; while((c=getchar( ))!=EOF) { switch(c) { case ' ' :word++; break; case '\n':line++; break; case 'a' :a++; break; case 'A' :ca++; break; } } printf("No:Of Words\t No:Of Lines\tNo:of a's\t No:ofA's\t"); printf("\n%d\t\t%d\t%d\t%d\t",word,line,a,ca); return 0; }
i have attached .c and .out file



LinkBack URL
About LinkBacks


