#include <stdio.h> #include <Windows.h> int main(void) { char word[128]; int count = 0; int length = 0; printf("请输入任意多个单词:\n"); while (1) { if (scanf("%s",word) != -1) { count++; length += strlen(word); } else { break; } } printf("你输入的单词个数为:%d\n", count); printf("你输入的字符长度为:%d\n", length); system("pause"); return 0; }
原文地址:https://www.cnblogs.com/tanghaiyong/p/11331282.html
时间: 2024-10-25 01:32:55