#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 关注
- 1264 浏览
添加回答
举报
0/150
提交
取消