为了账号安全,请及时绑定邮箱和手机立即绑定

我想问用平均数比大小来猜数字那个平均数怎么打?

我想问用平均数比大小来猜数字那个平均数怎么打?

C
慕粉4170453 2016-11-06 23:33:14
#include<stdio.h>#include<math.h>int main(void){ char ch; int a=50,i=0,c; int b=100; printf("Pick an integer from 1 to 100. I will try to guess it.\n"); printf("Respond with an 'b' if my quess is big and with\n"); printf("an '1' if it is little.\n"); printf("Also,Resond an 'y' if it is right.\n"); printf("Un...is your number 50?\n"); while((ch=getchar())!='y') { if(ch=='1') { c=(a+b)/2; ???????? printf("Well,then,is it %d?\n",c); } else if(ch=='b') {c=(a+i)/2; c=(a+i)/2; ???????? printf("Well,then,is it %d?\n",c); } else { printf("Sorry,I understand only 'b','1'or'y'.\n"); } while(getchar()!='\n') continue; } printf("I know I could do it!\n"); return 0;}
查看完整描述

目前暂无任何回答

  • 0 回答
  • 1 关注
  • 1246 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信