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;
- namespace ConsoleApplication1
- {
- class punkt
- {
- private int x;
- private int y;
- public punkt(int wspolrz1, int wspolrz2)
- {
- x = wspolrz1;
- y = wspolrz2;
- }
- static public void nawspolnej(punkt[] tab)
- {
- int dlugosc = tab.Length;
- for (int i = 0; i < dlugosc - 1; i++)
- {
- if (tab[i].x == tab[i + 1].x || tab[i].y == tab[i + 1].y)
- Console.WriteLine("Punkty ({0},{1}) i ({2},{3}) leΕΌΔ na jednej prostej");
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- punkt[] punkty = new punkt[3];
- punkty[0] = new punkt(2, 2);
- punkty[1] = new punkt(4, 2);
- punkty[2] = new punkt(5, 5);
- punkt.nawspolnej(punkty);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement