fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int i, ch;
  6. int cnt[10] = {0};
  7.  
  8. while(1) {
  9. ch = getchar();
  10. if (ch == EOF ) break;
  11.  
  12. if ( ch >= '0' && ch <= '9‘ )
  13. cnt[ ch - '0]++;
  14. }
  15.  
  16. puts("数字文字の出現回数");
  17. for (i = 0; i < 10; i++)
  18. printf("'%d': %d\n", i, cnt[i]);
  19.  
  20. return (0);
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:12:29: warning: missing terminating ' character
prog.cpp:12: error: missing terminating ' character
prog.cpp:13:18: warning: missing terminating ' character
prog.cpp:13: error: missing terminating ' character
prog.cpp: In function ‘int main()’:
prog.cpp:14: error: expected primary-expression before ‘}’ token
prog.cpp:14: error: expected `]' before ‘}’ token
prog.cpp:14: error: expected `)' before ‘}’ token
prog.cpp:14: error: expected primary-expression before ‘}’ token
prog.cpp:14: error: expected `;' before ‘}’ token
stdout
Standard output is empty