I want it to add 10 to the current hunger level when they press F and 10 to the current thirst level when they press D. Currently it feeds it automatically without me pressing anything. I know the location of the code is wrong but how should I fix it
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter your name, please: ");
string name = Console.ReadLine();
Console.WriteLine("Good choice, " + name);
Console.Write("Press F to feed yourself(+10) and D to drink some water(+10)");
Console.WriteLine(" ");
int hunger = 60;
int thirst = 60;
while (hunger < 101)
while (hunger > 1)
while (thirst < 101)
while (thirst > 1)
if (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.F))
{
System.Threading.Thread.Sleep(500);
{
hunger = hunger + 10;
Console.Write("Food: {0:0.0}".PadRight(15), hunger);
Console.Write("Water: {0:0.0}".PadRight(70), thirst);
}
}
if (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.F))
{
System.Threading.Thread.Sleep(500);
{
thirst = thirst + 10;
Console.Write("Food: {0:0.0}".PadRight(15), hunger);
Console.Write("Water: {0:0.0}".PadRight(70), thirst);
}
}
{
System.Threading.Thread.Sleep(5000);
Console.Write(" ");
{
hunger = hunger - 2;
thirst = thirst - 4;
Console.Write("Food: {0:0.0}".PadRight(15), hunger);
Console.Write("Water: {0:0.0}".PadRight(70), thirst);
}
if (thirst < 1)
{
Console.Write("You died from dehydration, RIP:" + name);
System.Threading.Thread.Sleep(3000);
{
System.Environment.Exit(1);
}
}
if (thirst > 101)
{
Console.Write("You died from drinking too much, RIP:" + name);
System.Threading.Thread.Sleep(3000);
{
System.Environment.Exit(1);
}
}
}
if (hunger < 1)
{
Console.Write("You died from not eating enough, RIP:" + name);
System.Threading.Thread.Sleep(3000);
{
System.Environment.Exit(1);
}
}
if (hunger > 101)
{
Console.Write("You died from over feeding, RIP:" + name);
System.Threading.Thread.Sleep(3000);
{
System.Environment.Exit(1);
}
}
}
}
}