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
26
27
28
/*Hello everybody! And this is my new program! It is noteworthy that projects are now coming out not often. But this project is something really cool. He finds 2 numbers that match! (Exits 1 to 100!) Attempt 1: - 23 and 45 Did not match! Attempt 2: 56 and 21 did not match! And so, until it coincides! In short, just click on the run button!
*/
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
int x = 1;
srand (time (0));
int rand1 = 1+rand()%100;
int rand2 = 1+rand()%100;
do
{
rand1 = 1+rand()%100;
rand2 = 1+rand()%100;
cout<<"finding... Try... "<<x++<<endl;
cout<<"rand1 - "<<rand1<<endl;
cout<<"rand2 - "<<rand2<<endl;
}
while (rand1!=rand2);
cout<<"\nYeah! We found it!\n ";
cout<<"\nRand1 - "<<rand1<<endl;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run