#include <stdio.h> struct ball{ char *name; int value; }; char compare_balls(struct ball b1,struct ball b2,struct ball b3){ // 输出三个中不一样的数字 if (b1.value!=b2.value && b1.value!=b3.value){return *b1.name;} if (b2.value!=b1.value && b2.value!=b3.value){return *b2.name;} if (b3.value!=b1.value && b3.value!=b2.value){return *b3.name;} } int main(void){ int a,b,c; struct ball b1,b2,b3; char r; if (scanf("%d %d %d",&a,&b,&c)!=0){ b1.name = "A"; b1.value = a; b2.name = "B"; b2.value = b; b3.name = "C"; b3.value = c; r = compare_balls(b1,b2,b3); printf("%c",r); }else{ printf("输入数据存在异常"); } return 0; }
c语言编程练习题:7-22 用天平找小球
作者:yunjinqi
类别:编程
日期:2023-05-29 13:18:37
阅读:538 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/147
最新文章
系统当前共有 404 篇文章