Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.  
  9.     class punkt
  10.     {
  11.         private int x;
  12.         private int y;
  13.  
  14.         public punkt(int wspolrz1, int wspolrz2)
  15.         {
  16.             x = wspolrz1;
  17.             y = wspolrz2;
  18.         }
  19.  
  20.         static public void nawspolnej(punkt[] tab)
  21.         {
  22.             int dlugosc = tab.Length;
  23.  
  24.             for (int i = 0; i < dlugosc - 1; i++)
  25.             {
  26.                 if (tab[i].x == tab[i + 1].x || tab[i].y == tab[i + 1].y)
  27.                     Console.WriteLine("Punkty ({0},{1}) i ({2},{3}) leΕΌΔ… na jednej prostej");
  28.  
  29.             }
  30.  
  31.         }
  32.  
  33.     }
  34.     class Program
  35.     {
  36.         static void Main(string[] args)
  37.         {
  38.             punkt[] punkty = new punkt[3];
  39.  
  40.             punkty[0] = new punkt(2, 2);
  41.             punkty[1] = new punkt(4, 2);
  42.             punkty[2] = new punkt(5, 5);
  43.  
  44.             punkt.nawspolnej(punkty);
  45.             Console.ReadKey();
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement