include iostream include stdlib include time using namespace std int i

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int irand(int a, int b)
{
return rand()%(b-a+1)+a;
}
int f (int n, int h)
{ if (n > h)
return 1;
if (n<h)
return 2;
return 3;
}
int main()
{
setlocale(LC_ALL, "Russian");
int l,z, h;
cout << "Введите два числа " << endl;
cin >> l >> z;
h = irand(l,z);
int n;
while (true){
cout << "ведите число от " << l << " до " << z << endl;
cin >> n;
int a = f(n ,h);
if (a==1) {
cout << "перелет" << endl;
continue;
}
if (a==2) {
cout << "недолет" << endl;
continue;
}
if (a==3) {
cout << "попал" << endl;
break;
}
}
return 0;
}