版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_38228254/article/details/80136249
看代码:
#include<ctype.h>
#include<stdio.h>
#include <iostream>
using namespace std;
int main(void){
char ch;
int total;
total=0;//初始化
/*统计字母块*/
do{
ch=getchar();
if(isalpha(ch)!=0)
total++;
}while(ch!='.');//结束符号为 .
printf("The total of letters is %d \n",total);
return 0;
}
所以输入输出大概如下:
输入:123456+1s
输出:The total of letters is 1
因为只有s是数字。