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 zad_6._1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Witaj w moim programie");
- Obraz kolekcja = new Obraz();
- while (true)
- {
- Console.WriteLine("Co chcesz zrobic?");
- Console.WriteLine("1.Stworzyc trojkat.");
- Console.WriteLine("2.Stworzyc czworokąt.");
- Console.WriteLine("3.Dodać trójkąt do kolekcji.");
- Console.WriteLine("4.Dodać kwadrat do kolekcji.");
- int choise = int.Parse(Console.ReadLine());
- if (choise == 1)
- {
- Console.WriteLine("Podaj wspolrzedne punktu");
- int Wspx = int.Parse(Console.ReadLine());
- int Wspy = int.Parse(Console.ReadLine());
- Punkt dot1 = new Punkt(Wspx, Wspy);
- Console.WriteLine("Podaj wspolrzedne punktu");
- Wspx = int.Parse(Console.ReadLine());
- Wspy = int.Parse(Console.ReadLine());
- Punkt dot2 = new Punkt(Wspx, Wspy);
- Console.WriteLine("Podaj wspolrzedne punktu");
- Wspx = int.Parse(Console.ReadLine());
- Wspy = int.Parse(Console.ReadLine());
- Punkt dot3 = new Punkt(Wspx, Wspy);
- if (dot1.X == dot2.X && dot1.Y == dot2.Y || dot1.X == dot3.X && dot1.Y == dot3.Y || dot2.X == dot3.X && dot2.Y == dot3.Y)
- {
- Console.WriteLine("Nie może być 2 tych samych punktów.");
- break;
- }
- Linia line1 = new Linia(dot1, dot2);
- Linia line2 = new Linia(dot2, dot3);
- Linia line3 = new Linia(dot1, dot3);
- if (line1.Dlugosc(dot1, dot2) >= line2.Dlugosc(dot2, dot3) + line3.Dlugosc(dot1, dot3) || line2.Dlugosc(dot2, dot3) >= line1.Dlugosc(dot1, dot2) + line3.Dlugosc(dot1, dot3) || line3.Dlugosc(dot1, dot3) >= line1.Dlugosc(dot1, dot2) + line2.Dlugosc(dot2, dot3))
- {
- Console.WriteLine("Nieodpowiednie długości boków.");
- break;
- }
- Trojkat triangle = new Trojkat(line1, line2, line3);
- Console.WriteLine("Czy dodac trojkat do kolekcji?");
- string wybor = Console.ReadLine();
- if (wybor == "tak")
- {
- kolekcja.DodajTrojkat(triangle);
- }
- }
- else if (choise == 2)
- {
- Console.WriteLine("Podaj wspolrzedne punktu");
- int Wspx = int.Parse(Console.ReadLine());
- int Wspy = int.Parse(Console.ReadLine());
- Punkt dot1 = new Punkt(Wspx, Wspy);
- Console.WriteLine("Podaj wspolrzedne punktu");
- Wspx = int.Parse(Console.ReadLine());
- Wspy = int.Parse(Console.ReadLine());
- Punkt dot2 = new Punkt(Wspx, Wspy);
- Console.WriteLine("Podaj wspolrzedne punktu");
- Wspx = int.Parse(Console.ReadLine());
- Wspy = int.Parse(Console.ReadLine());
- Punkt dot3 = new Punkt(Wspx, Wspy);
- Console.WriteLine("Podaj wspolrzedne punktu");
- Wspx = int.Parse(Console.ReadLine());
- Wspy = int.Parse(Console.ReadLine());
- Punkt dot4 = new Punkt(Wspx, Wspy);
- if (dot1.X == dot2.X && dot1.Y == dot2.Y || dot1.X == dot3.X && dot1.Y == dot3.Y || dot2.X == dot3.X && dot2.Y == dot3.Y || dot1.X == dot4.X && dot1.Y == dot4.Y || dot2.X == dot4.X && dot2.Y == dot4.Y || dot3.X == dot4.X && dot3.Y == dot4.Y)
- {
- Console.WriteLine("Nie może być 2 tych samych punktów.");
- break;
- }
- Linia line1 = new Linia(dot1, dot2);
- Linia line2 = new Linia(dot1, dot4);
- Linia line3 = new Linia(dot2, dot3);
- Linia line4 = new Linia(dot3, dot4);
- Kwadrat square = new Kwadrat(line1, line2, line3, line4);
- Console.WriteLine(line1.toString());
- Console.WriteLine("Czy dodac kwadrat do kolekcji?");
- string wybor1 = Console.ReadLine();
- if (wybor1 == "tak")
- {
- kolekcja.DodajKwadrat(square);
- }
- Console.WriteLine("O ile chcesz przesunac kwadrat?");
- int moveX = int.Parse(Console.ReadLine());
- int moveY = int.Parse(Console.ReadLine());
- square.Przesun(moveX, moveY);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement