Advertisement
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 Rysowanie
- {
- class Kwadrat
- {
- private int wysokosc = 0, szerokosc = 0;
- public string znak;
- public Kwadrat()
- {
- Console.ForegroundColor = ConsoleColor.Red;
- znak = "x";
- }
- public void rysuj()
- {
- Console.WriteLine("Podaj wysokosc");
- wysokosc = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj szerokośc");
- szerokosc = Convert.ToInt32(Console.ReadLine());
- for (int a = 0; a < wysokosc; a++)
- {
- for (int b=1; b < szerokosc; b++)
- {
- Console.Write(znak);
- }
- Console.WriteLine(znak);
- }
- Console.ReadKey();
- }
- }
- class Trojkat
- {
- static Trojkat()
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- }
- public static void rysuj()
- {
- int wysokosc = 0;
- Console.WriteLine("Podaj wysokość");
- wysokosc = Convert.ToInt32(Console.ReadLine());
- for (int wiersze = 1; wiersze <= wysokosc; wiersze++)
- {
- for (int a = wysokosc; a > wiersze; a--)
- {
- Console.Write(" ");
- }
- for (int gwiazdki = 0; gwiazdki < wiersze; gwiazdki++)
- {
- Console.Write("*");
- }
- for (int gwiazdki = 1; gwiazdki < wiersze; gwiazdki++)
- {
- Console.Write("*");
- }
- Console.WriteLine("");
- }
- Console.ReadKey();
- }
- }
- class Kolo
- {
- public string znak = "";
- private int wysokosc = 0;
- public Kolo(Kwadrat kolo)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- }
- public Kolo(int wysokosc_kola)
- {
- wysokosc = wysokosc_kola;
- }
- public void rysuj()
- {
- Console.WriteLine("Podaj średnice");
- wysokosc = Convert.ToInt32(Console.ReadLine());
- for (int wiersze = 1; wiersze <= wysokosc; wiersze++)
- {
- for (int a = wysokosc; a > wiersze; a--)
- {
- Console.Write(" ");
- }
- for (int gwiazdki = 0; gwiazdki < wiersze; gwiazdki++)
- {
- Console.Write("X");
- }
- for (int gwiazdki = 1; gwiazdki < wiersze; gwiazdki++)
- {
- Console.Write("X");
- }
- Console.WriteLine("");
- }
- for (int wiersze = 1; wiersze <= wysokosc-1; wiersze++)
- {
- for (int a = 1; a <= wiersze; a++)
- {
- Console.Write(" ");
- }
- for (int gwiazdki = wysokosc; gwiazdki >= wiersze+1; gwiazdki--)
- {
- Console.Write("X");
- }
- for (int gwiazdki = wysokosc ; gwiazdki >= wiersze+2; gwiazdki--)
- {
- Console.Write("X");
- }
- Console.WriteLine("");
- }
- Console.ReadKey();
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Witam w programie do rysowania\n" +
- "1. Rysowanie Kwadratu\n" +
- "2. Rysowanie Trojkata\n" +
- "3. Rysowanie Koła\n");
- int funkcja;
- funkcja = Convert.ToInt32(Console.ReadLine());
- switch(funkcja)
- {
- case 1:
- {
- Console.Clear();
- Console.WriteLine("Rysowanie Kwadratu");
- Kwadrat kwadrat1 = new Kwadrat();
- kwadrat1.rysuj();
- break;
- }
- case 2:
- {
- Console.Clear();
- Console.WriteLine("Rysowanie Trójkąta");
- //Trojkat trojkat1 = new Trojkat();
- Trojkat.rysuj();
- break;
- }
- case 3:
- {
- Console.Clear();
- Console.WriteLine("Rysoawnie Koła");
- Kolo kolo1 = new Kolo();
- kolo1.rysuj();
- break;
- }
- default:
- {
- Console.Clear();
- Console.WriteLine("ZŁE DANE! PROGRAM ZOSTANIE ZAMKNIĘTY!");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement