猜数字
2025-01-15 10:37:02
发布于:北京
不喜勿喷
喜欢就点个赞吧!
#include <bits/stdc++.h>
#define endl "\n"
#define Ll long long
using namespace std;
const int N = 1e5 + 10, M = 1e2 + 10;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
Ll n;
int main(){
srand(time(NULL));
int a = rand() % 101;
while(1){
cin >> n;
if(n == a){
puts("恭喜你,你猜对了!");
break;
}
else if(n < a) cout << "你猜的数字小了!" << endl << endl;
else cout << "你猜的数字大了!" << endl << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个