#include<iostream>
using namespace std;
#include<ctime>
int main()
{
srand((unsigned int)time(NULL));
int const num = rand() % 100 + 1;
int bal = 0;
while (1)
{
cin >> bal;
if (bal > num)
{
cout << "猜测过大" << endl;
}
else if (bal<num)
{
cout << "猜测过小" << endl;
}
else
{
cout << "恭喜你猜对了" << endl;
break;
}
}
system("pausse");
return 0;
}
【利用whlie语句编写猜数字游戏】c++
最新推荐文章于 2024-08-19 18:41:12 发布