CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//enter a number from 1 to 10. You can run it as many times as you want and get different correct answers.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int a;
cin>>a;
srand(time(0));
int b=rand()%10+1;
if(a>0 and a<11){
if(a==b){
cout<<"You win!";
}
else{
cout<<"You lose!";
}
}
else{cout<<"Didn't you read the instructions?????";}
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run