#include <stdio.h> #include <string.h>

int main() { char s[100][80]; int cnt = 0, flag = 0, k = 0; while (1) { fgets(s[cnt], 80, stdin); if (s[cnt][0] == '.') break; cnt++; } printf("%d\n", cnt); for (int i = 0; i < cnt; i++) { for (int j = 0; j < strlen(s[i]); j++) { if (s[i][j] == 'c' && s[i][j + 1] == 'h' && s[i][j + 2] == 'i' && s[i][j + 3] == '1' && s[i][j + 4] == ' ' && s[i][j + 5] == 'h' && s[i][j + 6] == 'u' && s[i][j + 7] == 'o' && s[i][j + 8] == '3' && s[i][j + 9] == ' ' && s[i][j + 10] == 'g' && s[i][j + 11] == 'u' && s[i][j + 12] == 'o' && s[i][j + 13] == '1') { if (flag == 0) { printf("%d %d\n", i + 1, cnt - i); flag = 1; } k++; break; } } } if (flag == 0) printf("-_-#\n"); return 0;

编写一个C语言代码自动检查你朋友给你发来的信息里有没有 chi1 huo3 guo1。输入格式:输入每行给出一句不超过 80 个字符的、以回车结尾的朋友信息信息为非空字符串仅包括字母、数字、空格、可见的半角标点符号。当读到某一行只有一个英文句点 时输入结束此行不算在朋友信息里。输出格式:首先在一行中输出朋友信息的总条数。然后对朋友的每一行信息检查其中是否包含 chi1 huo3 guo1并且统计

原文地址: https://www.cveoy.top/t/topic/hpiL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录