Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1.     class Program
  2.     {
  3.         static Random rand = new Random();
  4.         static void Main(string[] args)
  5.         {
  6.             //látnivalók száma
  7.             int numberOfSpectacles = rand.Next(50, 101);
  8.             Console.WriteLine("We create " + numberOfSpectacles + " spectacles.");
  9.             Spectacle[] sp = new Spectacle[numberOfSpectacles];
  10.             for (int i = 0; i < sp.Length; i++)
  11.             {
  12.                 sp[i] = new Spectacle();
  13.                 Console.WriteLine(sp[i].display());
  14.             }
  15.  
  16.             //beolvasunk egy kezdőpontot
  17.             Console.WriteLine("We create a track of spectacles that are close(<5)\n to a given starting point.");
  18.             Console.Write("Give a starting point x,y: ");
  19.             string s = Console.ReadLine().Trim();
  20.             int startx = int.Parse(s.Substring(0, s.IndexOf(',')));
  21.             int starty = int.Parse(s.Substring(s.IndexOf(',') + 1));
  22.             //útvonal létrehozása
  23.             Track tr = new Track(startx, starty, sp);
  24.             Console.WriteLine(tr.display());
  25.             Console.WriteLine("\nThe end.");
  26.             Console.ReadLine();
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement