Ú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!
- Új 2K Gamer PC Intel i7 14700Kf/RX 9060 XT 16Gb/2x16Gb DDR4 3200Mhz/1Tb NVME SSD/2-3Év gari
- Új 4K Gamer PC Intel i7 14700Kf/RX 9070 XT 16Gb/2x16Gb DDR4 3200Mhz/1Tb NVME SSD/2-3Év gari
- Új 4K Gamer PC Intel i7 14700Kf/RX 5070 12Gb/2x16Gb DDR4 3200Mhz/1Tb NVME SSD/2-3Év gari
- Samsung Galaxy S23 Ultra 5G 256GB, Kártyafüggetlen, 1 Év Garanciával
- Új Gamer PC - Ryzen 7 5700X / RTX 5060 Ti / B550M / 16GB RAM - 3600MHz / 1TB SSD / 600W
- 5G Lenovo ThinkPad P14s Gen 3 Intel Core i7-1280P Nvidia T550 32GB 1000GB 1 év teljeskörű garancia
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- BESZÁMÍTÁS! Intel Core i7 6700K 4 mag 8 szál processzor garanciával hibátlan működéssel
- iPhone 11 64GB 100% (3hónap Garancia)
- Dell Precision 7550 i7-10850H 32GB 1TB Nvidia RTX3000 6GB 1 év garancia
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

