-
Notifications
You must be signed in to change notification settings - Fork 34
/
Program.cs
35 lines (31 loc) · 1.07 KB
/
Program.cs
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
int RequestNumber(string message)
{
Console.WriteLine(message);
string line = Console.ReadLine();
return Convert.ToInt32(line);
}
int CreateSecretNumber(int leftBound, int rightBound) {
return new Random().Next(leftBound, rightBound);
}
bool MakeMove(int secretNumber, int countOfAttempts)
{
int playersNumber = RequestNumber("У вас осталось " + countOfAttempts + " попыток. " + "Введите число: ");
if (playersNumber == secretNumber)
{
return true;
}
if (playersNumber > secretNumber)
{
Console.WriteLine("Ваше число больше того, которое мы загадали");
} else
{
Console.WriteLine("Ваше число меньше того, которое мы загадали");
}
return false;
}
int leftBound = 0;
int rightBound = 100;
int countOfAttempts = 7;
int secretNumber = CreateSecretNumber(leftBound, rightBound);
// int number = RequestNumber("Введите число: ");
Console.WriteLine(secretNumber);