Home > Back-end >  For bosses to solve? This program run on Devc show id returned 1 exit status
For bosses to solve? This program run on Devc show id returned 1 exit status

Time:03-04

Statistical text characters
#include
Int main () {
int c;
Int nd=0, nb=0, nl=0, nc=0, nn=0;
While ((c=getchar ())!=(EOF)
The switch (c) {
Case ': + + nb; break;
Case: '1' case '2' : case '3' : a case of '4' : a case of '5' : case '6' : case '7' : case '8' : case '9' : case '0' :
+ + nd; break;
Case '\ n' : + + nl; break;
Case '{' :
Case '} ':
+ + nc; break;
Default:
+ + nn. break;
}
Printf (" lines Spaces: % d: % d, who: % d ", nb, nl, nd).
Printf (" {and} : % d, others: % d \ n ", nc, nn);
return 0;
}

CodePudding user response:

 # include 

Int main () {
int c;
Int nd=0, nb=0, nl=0, nc=0, nn=0;
While ((c=getchar ())!=(EOF) {//missing here '{'
The switch (c) {
Case ":
+ + nb.
break;
Case '1' :
Case '2' :
Case '3' :
Case '4' :
Case '5' :
Case '6' :
Case '7' :
Case '8' :
Case '9' :
Case '0' :
+ + nd;
break;
Case '\ n' :
+ + nl;
break;
Case '{' :
Case '} ':
+ + nc;
break;
Default:
+ + nn.
break;
}
}//'} 'is missing here
Printf (" lines Spaces: % d: % d, who: % d ", nb, nl, nd).
Printf (" {and} : % d, others: % d \ n ", nc, nn);

return 0;
}
  • Related