一、N-S流程图;
二、运行结果;
三、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>int main()
{//初始化变量值;char c = 0;int a = 0, k = 0, n = 0, q = 0;//提示用户;printf("请输入一段话:");//获取键盘输入;c = getchar();//循环判断不同字符数量;while (c != '\n'){//字母;if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')){//自增;a++;}else if (c == ' '){//自增;k++;}else if (c >= 0 && c <= 9){//自增;n++;}else{//自增;q++;}//获取键盘输入数据;c = getchar();}//输出结果;printf("你输入的语句中有字母%d个,空格%d个,数字%d个,其它字符%d个!!!\n", a, k, n, q);return 0;
}