laci200270

Házi 02.15

Feb 20th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.36 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace HetNapjai
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("A hét napjai");
  14.             int eddigiek = 0;
  15.             int mostaniszam=-1;
  16.             int elozoSzam = -1;
  17.            
  18.             while (mostaniszam != 0) {
  19.                 Console.ResetColor();
  20.                 Console.Write("Kérek egy számot 0tól 7 ig: ");
  21.                 elozoSzam = mostaniszam;
  22.                 mostaniszam = int.Parse(Console.ReadLine());
  23.                 while (mostaniszam > 7 || mostaniszam < 0) {
  24.                     Console.Write("Hibás bemenet kérlek add meg újra");
  25.                    
  26.                     mostaniszam = int.Parse(Console.ReadLine());
  27.  
  28.                 }
  29.  
  30.                 if (elozoSzam == -1)
  31.                     Console.ResetColor();
  32.                 else
  33.                 {
  34.                     if (elozoSzam < mostaniszam)
  35.                         Console.ForegroundColor = ConsoleColor.Blue;
  36.                     else
  37.                         Console.ForegroundColor = ConsoleColor.Red;
  38.                 }
  39.                 switch(mostaniszam){
  40.                     case 1:
  41.                         Console.WriteLine("Hétfő");
  42.                         break;
  43.                     case 2:
  44.                         Console.WriteLine("Kedd");
  45.                         break;
  46.                     case 3:
  47.                         Console.WriteLine("Szerda");
  48.                         break;
  49.                     case 4:
  50.                         Console.WriteLine("Csütörtök");
  51.                         break;
  52.                     case 5:
  53.                         Console.WriteLine("Péntek");
  54.                         break;
  55.                     case 6:
  56.                         Console.WriteLine("Szombat");
  57.                         break;
  58.                     case 7:
  59.                         Console.WriteLine("Vasárnap");
  60.                         break;
  61.                     case 0:
  62.                         Console.ResetColor();
  63.                         Console.WriteLine("Összesen {0} darab napot írtunk ki.",eddigiek);
  64.                         Console.ReadKey();
  65.                         break;
  66.                 }
  67.                
  68.             }
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment