Advertisement
Bayonara

Untitled

Sep 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace LessonTre
  6. {
  7.     public class Pixels
  8.     {
  9.         public static void Ex1()
  10.         {
  11.             RedPixel(10);
  12.             BluePixel(5);
  13.             BlackPixel(5);
  14.             YellowPixel(15);
  15.  
  16.             Console.ReadLine();
  17.         }
  18.  
  19.         public static void Ex2()
  20.         {
  21.             for (int i = 0; i < 11; i++)
  22.             {
  23.                 BluePixel(30);
  24.                 YellowPixel(20);
  25.                 BluePixel(70);
  26.             }
  27.  
  28.             for (int i = 0; i < 8; i++)
  29.             {
  30.                 YellowPixel(120);
  31.             }
  32.  
  33.             for (int i = 0; i < 11; i++)
  34.             {
  35.                 BluePixel(30);
  36.                 YellowPixel(20);
  37.                 BluePixel(70);
  38.             }
  39.  
  40.             Console.ReadLine();
  41.         }
  42.  
  43.         static void YellowPixel(int x = 1)
  44.         {
  45.             for (int i = 0; i < x; i++)
  46.             {
  47.                 Console.BackgroundColor
  48.                             = ConsoleColor.Yellow;
  49.  
  50.                 Console.Write(" ");
  51.             }
  52.         }
  53.  
  54.         static void BluePixel(int x = 1)
  55.         {
  56.             for (int i = 0; i < x; i++)
  57.             {
  58.                 Console.BackgroundColor
  59.                             = ConsoleColor.Blue;
  60.  
  61.                 Console.Write(" ");
  62.             }
  63.         }
  64.         static void RedPixel(int x = 1)
  65.         {
  66.             for (int i = 0; i < x; i++)
  67.             {
  68.                 Console.BackgroundColor
  69.                             = ConsoleColor.Red;
  70.  
  71.                 Console.Write(" ");
  72.             }
  73.         }
  74.         static void BlackPixel(int x = 1)
  75.         {
  76.             for (int i = 0; i < x; i++)
  77.             {
  78.                 Console.BackgroundColor
  79.                             = ConsoleColor.Black;
  80.  
  81.                 Console.Write(" ");
  82.             }
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement