Логика угадайки добавлена

This commit is contained in:
DIvan2000 2024-12-14 14:59:54 +04:00
parent 7be59a5cf0
commit d1ebd91521

View File

@ -79,6 +79,7 @@ namespace ProgLab1.GUI
{ {
input.BackColor = SystemColors.Window; input.BackColor = SystemColors.Window;
double inputNum = double.Parse(input.Text); double inputNum = double.Parse(input.Text);
Console.WriteLine(Math.Abs(answer - inputNum));
if (Math.Abs(answer - inputNum) < 0.1) if (Math.Abs(answer - inputNum) < 0.1)
{ {
@ -87,6 +88,11 @@ namespace ProgLab1.GUI
{ {
tryes--; tryes--;
} }
if(tryes <= 0)
{
this.Close();
}
} }
tryCount.Text = $"Количество попыток: {tryes}"; tryCount.Text = $"Количество попыток: {tryes}";