Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HetNapjai
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("A hét napjai");
- int eddigiek = 0;
- int mostaniszam=-1;
- int elozoSzam = -1;
- while (mostaniszam != 0) {
- Console.ResetColor();
- Console.Write("Kérek egy számot 0 tól 7 ig: ");
- elozoSzam = mostaniszam;
- mostaniszam = int.Parse(Console.ReadLine());
- while (mostaniszam > 7 || mostaniszam < 0) {
- Console.Write("Hibás bemenet kérlek add meg újra");
- mostaniszam = int.Parse(Console.ReadLine());
- }
- if (mostaniszam != 0)
- eddigiek++;
- if (elozoSzam == -1)
- Console.ResetColor();
- else
- {
- if (elozoSzam < mostaniszam)
- Console.ForegroundColor = ConsoleColor.Blue;
- else
- Console.ForegroundColor = ConsoleColor.Red;
- }
- switch(mostaniszam){
- case 1:
- Console.WriteLine("Hétfő");
- break;
- case 2:
- Console.WriteLine("Kedd");
- break;
- case 3:
- Console.WriteLine("Szerda");
- break;
- case 4:
- Console.WriteLine("Csütörtök");
- break;
- case 5:
- Console.WriteLine("Péntek");
- break;
- case 6:
- Console.WriteLine("Szombat");
- break;
- case 7:
- Console.WriteLine("Vasárnap");
- break;
- case 0:
- Console.ResetColor();
- Console.WriteLine("Összesen {0} darab napot írtunk ki.",eddigiek);
- Console.ReadKey();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment