作业帮 > 综合 > 作业

C语言字符串计数Write a program that reads an English statement from

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/01 23:58:50
C语言字符串计数
Write a program that reads an English statement from the keyboard and thenreports the number of spaces read,the number of uppercase characters read,thenumber of lowercase characters read,and the number of all other charactersread.(Hint:You can usescanf(“%c”,&aChar); to keep reading characters from keyboard until anew-line character been read )
C语言字符串计数Write a program that reads an English statement from
Here you are the program in C:

#include
int main(){
int sp=0,upper=0,low=0,num=0,oth=0;
int ch;
while(1){
ch = getchar();
if (ch=='\n') break;
if (ch==' ') sp=sp+1;
else if (ch>='A' && ch ='a' && ch ='0' && ch ='0' && ch