Hirdetés
Új hozzászólás Aktív témák
-
nmate91
tag
using System;
using System.Threading;
namespace ConsoleApp1
{
class Program
{
static int Increase(int count)
{
do
{
while (!Console.KeyAvailable)
{
Console.WriteLine($"count: {count++}");
Thread.Sleep(25);
}
} while (Console.ReadKey(true).Key != ConsoleKey.Spacebar);
return count;
}
static int Decrease(int count)
{
do
{
while (!Console.KeyAvailable)
{
Console.WriteLine($"count: {count--}");
Thread.Sleep(25);
}
} while (Console.ReadKey(true).Key != ConsoleKey.Spacebar);
return count;
}
static void Main(string[] args)
{
Console.WriteLine("Press Space to change, and ESC to stop");
do
{
int count = 0;
count = Increase(count);
count = Decrease(count);
} while (Console.ReadKey(true).Key != ConsoleKey.Escape);
}
}
}Hasonlo, decrease utan megall, ujra spacet nyomva indul, nullarol. Ha nem nullarol kell, csak ki kell tenni eggyel kijjebb a count deklaralast. Ha kell az 1000 hatarnak, csak a do while-nal kondiciokent kikotod.
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- 175 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5070Ti
- 174 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5070Ti
- 173 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5080
- 172 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5080
- LG OLED Evo G3, 65,''col, 4K
- Telefon felvásárlás!! iPhone 12 Mini/iPhone 12/iPhone 12 Pro/iPhone 12 Pro Max
- AKCIÓ! MSI Z77 MPOWER Z77 chipset alaplap garanciával hibátlan működéssel
- 153 - Lenovo LOQ (15IRX9) - Intel Core i5-13450HX, RTX 4060
- Dell D6000 univerzális dokkoló USB-C/ USB-A, DisplayLink & Dell WD15 (K17A) USB-C + 130-180W töltő
- Playstation 4 Pro 1 TB + kontroller 6 hó garancia, számlával!
Állásajánlatok
Cég: NetGo.hu Kft.
Város: Gödöllő
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


