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 charactersrea

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 01:52:10
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 charactersrea
xRJ1~֫-H"xf`$K^E^ăxy?} gSmxLfIR7׻zh|

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 charactersrea
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 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 charactersrea
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