#include<string.h> struct Student{ char name[20]; int count; }leader[3] = {"Lee", 0, "Lea", 0, "Elliot", 0}; int main(){ char leadername[20]; int i; while(scanf("%s", leadername) != EOF){ //按Ctrl+Z结束输入 for(i = 0; i < 3; i++){ if(strcmp(leadername, leader[i].name) == 0) leader[i].count++; } } for(i = 0; i < 3; i++) printf("%s: %d\n", leader[i].name, leader[i].count); return 0; }
初级程序员
by: 藤原千花 发表于:2020-04-20 20:27:50 顶(0) | 踩(0) 回复
666
回复评论