switch语句应用.pptVIP

  • 58
  • 0
  • 约1.01万字
  • 约 43页
  • 2016-08-20 发布于江苏
  • 举报
示例: 输入10个字符,分别统计出其中空格或回车、数字和其他字符的个数。 for(i = 1; i = 10; i++){ ch = getchar(); switch (ch) { case ‘?‘ : case ’\n‘ : blank ++; break; case 0 : case 1 : case 2 : case 3‘: case 4 : case 5 : case 6 : case 7 : case 8 : case 9 : digit ++; break; default: other ++; break; } } printf(“blank=%d, digit=%d, other=%d\n”, blank, digit, other); } if(flag==1) { printf(\n\n*****************

文档评论(0)

1亿VIP精品文档

相关文档