void main() { int errc = 0; bool in_sentence = false; bool in_word = false; char c; while(scanf("%c",&c) > 0) { if(in_sentence) { if(in_word) { if(iscapital(c)) errc++; if(ispunct(c)) in_word = false; } else { if(isalpha(c)) in_word = true; } if(isstop(c)) in_sentence = false; } else { if(isalpha(c)) { in_sentence = true; in_word = true; if(!iscapital(c)) errc++; } } } printf("%d",errc); }
int main (int argc, char *argv[]) { char *str = "He Is My Best Friend!"; int capcnt = 0; while (*str != '\0') { if (iscapital (*str)) capcnt++; str++; } printf ("대문자 개수 : %d \n", capcnt); return 0; }
bool ispunct(char c) { return (!iscapital(c) && !issmall(c) && !isstop(c)); }
bool isalpha(char c) { return issmall(c) || iscapital(c); }