?? 44.c
字號:
#include<stdio.h>
#include<string.h>
void C_program017()
{
char a[100];
int count1=0,count2=0,count3=0,count4=0;
int i=0,t;
gets(a);
t=strlen(a);
while(a[i]!='\0'&&i<=t)
{
if((a[i]<='z'&&a[i]>='a')||(a[i]<='z'&&a[i]>='a'))
count1++;
else if(a[i]<='9'&&a[i]>='0')
count2++;
else if(a[i]==' ')
count3++;
else
count4++; //因為要統計'\0',所以看上去比實際多一個。
i++;
}
printf("count1=%d\ncount2=%d\ncount3=%d\ncount4=%d\n",count1,count2,count3,count4);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -