2、统计输入的内容中有几个字母、数字和其他字符。
提示:
(1)变量c应该定义为int. 这是因为后面的EOF常量的值超出了字符类型char的表示范围. EOF的值一般为-1
(2)程序示例比较粗糙, 自行考虑是否应该选用if ... else ...结构
(3)判定是否为字母和数字,系统有库函数可供选用。#include
int c;
while ((c=getchar())!=EOF){
if (c是字母) ...
if (c是数字) ...
if (c是其他字符) ...
}
川川菜鸟的博客原题: 用赋初值的方法把字符串 “ C is a general purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the ...