main()
{ int low,high,mid,n
while(1){
樱亮 mid=15low=0high=31
printf("你的生日比%d号大还是小?大输入1,小输入2,等于侍颂判3.\n",mid)
scanf("%d",&n)
while(n!=3){
if(n==1)low=mid+1
if(n==2)high=mid-1
mid=(low+high)/2
printf("你的生日比%d号大还是小?大输入1,小输入2,等于3.\n",mid)
scanf("%d"老改,&n)
}
printf("你的生日是%d号\n",mid)
}
}
如图所示,望采纳。。。。。。
Dim count1 As IntegerPrivate Sub Command1_Click()
count1 = count1 / 2
text
End Sub
Private Sub Command2_Click()
count1 = count1 + count1 / 2
text
End Sub
Private Sub Command3_Click()
MsgBox "恭喜你搏铅毕猜对了激掘!", 65, "提示!"基芹
End Sub
Private Sub Form_Load()
count1 = 16
text
End Sub
Private Sub text()
Form1.Caption = "生日是" &Str(count1)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)