Ú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!
- Dell Inspiron 3593 15,6 Fullhd i7 16Gb SSD256Gb HDD1TB Win11pro
- Újszerű bivaly Lenovo Thinkpad T16 gen3 (13.gen Core Ultra 7 32Gb DDR5 1 Tb SSD) MAGYAR 30 hó GARI!
- Bivaly Lenovo T14 gen5 (Core Ultra 7 32Gb DDR5 1 Tb SSD) laptopom eladó 30 hónap gyártói garanciával
- Bomba ár! Dell Latitude 3410 - i3-10110U I 8GB I 256SSD I HDMI I 13,3" FHD Touch I Cam I W11 I Gari
- Bomba ár! Dell Latitude E5550 - i5-5GEN I 8GB I 128SSD I 15,6" FHD Touch I HDMI I W10 I Cam I Gari!
- iMac Pro 1.1 2017 Intel Xeon W2150B 64GB 1TB VEGA 64 16GB!!! 1 év garancia!
- Xiaomi 15 256GB, Kártyafüggetlen, 1 Év Garanciával
- GYÖNYÖRŰ iPhone 13 mini 128GB Pink -1 ÉV GARANCIA - Kártyafüggetlen, MS3841, 100% Akkumulátor
- iking - Apple iPhone 14 Pro Graphite ProMotion 120 Hz, 48 MP kamera, Dynamic Island 128 GB
- HIBÁTLAN iPhone 11 Pro 64GB Midnight Green -1 ÉV GARANCIA -Kártyafüggetlen, MS3372
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopműhely Bt.
Város: Budapest

