?? 7-7.c
字號:
#include<stdio.h>
int letter,digit,space,others;
main()
{
int count(char str[]);
char text[80];
printf("\n Input string:\n");
gets(text);
printf("string:");
puts(text);
letter=0;
digit=0;
space=0;
others=0;
count(text);
printf("letter=%d,digit=%d,space=%d,others=%d\n",letter,digit,space,others);
}
int count(char str[])
{
int i;
for(i=0;str[i]!='\0';i++)
if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z'))
letter++;
else if((str[i]>='0'&&str[i]<='9'))
digit++;
else if(str[i]==' ')
space++;
else
others++;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -