【 10.1a 】下面程序的功能是从键盘输入一行字符(不超过 80 个),统计其中的 英文字符 、 数字字符 、 空格 和 其他字符 的个数。例如,输入的一行字符为 *****c language.***** 输出为 English character: 9 digit character: 0 space: 1 other character: 11 按要求在下面程序的空白处填写适当的表达式或语句,使程序完整并符合题目要求。 1. #include
2. #include
3. #define STR_LEN 80 4. int main() 5. { 6. char str[STR_LEN+1]; 7. int len, i, letter = 0, digit = 0, space = 0, others = 0; 8. printf("Please input a string:"); 9. ___________; 10. for (i = 0; __________; i++) 11. { 12. if (___________________________) 13. letter ++; /* 统计英文字符 */ 14. else if (______________________) 15. digit ++; /* 统计数字字符 */ 16. else if (str[i] == ' ' ) 17. space ++; /* 统计空格 */ 18. else 19. others ++; /* 统计其他字符的个数 */ 20. } 21. printf("English character: %d\n", letter); 22. printf("digit character: %d\n", digit); 23. printf("space: %d\n", space); 24. printf("other character: %d\n", others); 25. return 0; 26. }