At the moment I have made a timer that outputs on multiple lines like this:
However, if the user chooses 1000 seconds that would take too much space.
I need a way so that it changes the first line to the number below automatically.
Here is my timer code:
public class TimerExample
{
static int UserInputs()
{
int numberOfSeconds;
do
{
Console.WriteLine("How many seconds would you like the test to be? Please type a number divisible by 10!");
int.TryParse(Console.ReadLine(), out numberOfSeconds);
} while (numberOfSeconds % 10 != 0);
return numberOfSeconds;
}
public class TimerClass
{
public static int Timers(int timeLeft)
{
do
{
Console.WriteLine($"timeLeft: {timeLeft}");
timeLeft--;
Thread.Sleep(1000);
} while (timeLeft > 0);
return timeLeft;
}
}
public static void Main(string[] args)
{
int numberOfSeconds = UserInput();
TimerClass.Timers(numberOfSeconds);
}
}
Here is my full code if you need it: https://github.com/CrazyDanyal1414/mathstester