- 分享
数字炸弹
- @ 2026-7-7 20:43:51
#include<bits/stdc++.h> using namespace std; int main() { srand(time(0)); int b = rand() % 100 + 1; int a; cout << "请输入数字 1——100:"; cin >> a; while (a != b) { if(a>b){ cout<<"太大了,请重试:"; cin >> a; } if(a<b){ cout<<"太小了,请重试:"; cin >> a; } } cout << "你真棒,猜对了!";
return 0;
}