Can someone tell me how to make a timer? I'm using C#, and the guides I find are always outdated. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Can someone tell me how to make a timer? I'm using C#, and the guides I find are always outdated.

21st Jan 2023, 2:14 AM
Sagan Wolfensberger
Sagan Wolfensberger - avatar
6 ответов
+ 6
Show us your attempt so that we can guide you
21st Jan 2023, 2:18 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 1
Please use relevant wordings in post tags, "uwu" bears no relevance to the question nor the related language (C#) https://code.sololearn.com/W3uiji9X28C1/?ref=app
21st Jan 2023, 4:55 AM
Ipang
+ 1
First of all "make a timer" is not even close to a program specification. Inside the limited Sololearn code playground, you can only write console application without interactivity. So my best guess is you could display the current time, or measure the time for the execution of a particular piece of code. If you meant something like a stopwatch that you could control on a visual UI, you cannot code that here. Point is, you should give more exact description what you want to achieve.
21st Jan 2023, 6:19 AM
Tibor Santa
Tibor Santa - avatar
+ 1
So, I had a basic idea of how to code a timer. It starts by creating a variable that the player assigns using Console.ReadLine(); which will be a number or it will not work. It then uses the ConvertToInt32 method to convert it to a number so it can be easily changed. This variable is now the set amount of time for the timer. There is a while loop that runs as long as the variable is above 0. Inside the loop, a.k.a. every time it runs, it outputs the time left and subtracts one. I will implement it running specifically every second later, but there's currently an error. At this point of typing this message, I have forgotten what the error said, but I know it was something along the lines of "The name ConvertToInt32 is not" and then something else.
21st Jan 2023, 1:30 PM
Sagan Wolfensberger
Sagan Wolfensberger - avatar
0
Can someone higher than my current skill level help me or teach me how to fix it?
21st Jan 2023, 1:33 PM
Sagan Wolfensberger
Sagan Wolfensberger - avatar
0
Nvm I found a guide 👍
22nd Jan 2023, 1:26 PM
Sagan Wolfensberger
Sagan Wolfensberger - avatar