Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 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. using System.IO;
  7.  
  8. namespace Akademia_17_Wizytowka_Pro
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Console.ForegroundColor = ConsoleColor.Blue;
  15.             Console.BackgroundColor = ConsoleColor.White;
  16.             Console.Clear();
  17.  
  18.             StreamReader plik = File.OpenText("wizytowka.txt");
  19.             while (!plik.EndOfStream)
  20.             {
  21.                 int kolor = int.Parse(plik.ReadLine());
  22.                 string tekst = plik.ReadLine();
  23.  
  24.                 switch (kolor)
  25.                 {
  26.                     case 0: Console.ForegroundColor = ConsoleColor.Black; break;
  27.                     case 1: Console.ForegroundColor = ConsoleColor.Blue; break;
  28.                     case 2: Console.ForegroundColor = ConsoleColor.DarkGreen; break;
  29.                     case 3: Console.ForegroundColor = ConsoleColor.Red; break;
  30.                 }
  31.  
  32.                 Console.WriteLine(tekst);
  33.             }
  34.             plik.Close();
  35.  
  36.             Console.ReadKey();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement