Advertisement
program12

PartiesNearBy

Jun 7th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     public struct party
  7.     {
  8.         public string city;
  9.         public string price;
  10.         public string name;
  11.     }
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             List<party> parties = new List<party>();
  17.             //parties.Add(new party() { city = "crank arm", price = 1234, name= "Melanz" });
  18.             Console.WriteLine("Wybierz opcję\n 1. Dodawanie imprezy\n 2. Szukanie Imprezy\n 3. Wyłącz Aplikacje");
  19.  
  20.             //foreach (party aPart in parties)
  21.             //{
  22.             //    Console.WriteLine("Nazwa imprezy: " + aPart.name+"\nCena wejścówki: "+ aPart.price + "\nMiejscowosc: " + aPart.city);
  23.             //}
  24.  
  25.             string caseSwitch;
  26.             caseSwitch = Console.ReadLine();
  27.             switch (caseSwitch)
  28.             {
  29.                 case "1":
  30.                     string sName;
  31.                     string sCity;
  32.                     string sPrice;
  33.                     Console.WriteLine("Podaj nazwę imprezy: ");
  34.                     sName = Console.ReadLine();
  35.                     Console.WriteLine("Podaj Miasto: ");
  36.                     sCity = Console.ReadLine();
  37.                     Console.WriteLine("Podaj cenę wejściówki imprezy: ");
  38.                     sPrice = Console.ReadLine();
  39.                     parties.Add(new party() { city = sCity, price = sPrice, name = sName });
  40.                     Console.WriteLine("Impreza Dodana");
  41.                     break;
  42.                 case "2":
  43.                     Console.WriteLine("Case 2");
  44.                     break;
  45.                 default:
  46.                     Console.WriteLine("Default case");
  47.                     break;
  48.             }
  49.             foreach (party aPart in parties)
  50.             {
  51.                 Console.WriteLine("Nazwa imprezy: " + aPart.name+"\nCena wejścówki: "+ aPart.price + "\nMiejscowosc: " + aPart.city);
  52.             }
  53.  
  54.             //nowa[0].city = "Gdynia";
  55.             //nowa[0].price = 21;
  56.             //nowa[0].name = "Melanz";
  57.             //Console.WriteLine("Siemka! Zapraszam na impreze o nazwie: " + nowa[0].name);
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement