[此贴子已经被作者于2018-5-8 23:08编辑过]
#include<stdio.h> int letter(char *); int dight(char *); int space(char *); int main() { char str[100]; gets(str); int m=0, n=0, z=0; m = letter(str); n = dight(str); z = space(str); printf("letter=%d,dight=%d,space=%d", m, n, z); return 0; } int letter(char *str) { int i = 0,count = 0; while (str[i]) { if ((str[i] >= 65 && str[i] <= 90) || (str[i] >= 97 && str[i] <= 122)) count++; i++; } return count; } int dight(char *str) { int i = 0, count = 0; while (str[i]) { if (str[i] >= 48&&str[i]<=57) count++; i++; } return count; } int space(char *str) { int i = 0, count = 0; while (str[i]) { if (str[i] == 32) count++; i++; } return count;
[此贴子已经被作者于2018-5-8 22:57编辑过]