Skip to content

Instantly share code, notes, and snippets.

@pmikstacki
Created April 18, 2018 06:49
Show Gist options
  • Save pmikstacki/21dbaf455f5ab1006ba57e5276eeb987 to your computer and use it in GitHub Desktop.
Save pmikstacki/21dbaf455f5ab1006ba57e5276eeb987 to your computer and use it in GitHub Desktop.
using System;
namespace hhh
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Witaj!");
Console.WriteLine("Podaj marke");
string marka = Console.ReadLine();
Console.WriteLine("Podaj kolor");
string kolor = Console.ReadLine();
//while(true){
//try{
//double dlugosc = double.Parse(Console.ReadLine());
//break;
//}catch{Console.WriteLine("jesteś debilem");}
//}
char k = 's';
while ((k != 'T') && (k != 'N'))
{
Console.WriteLine("Czy chcesz dodać przyczepe? T/N");
k = Console.ReadKey().KeyChar;
}
if (k == 'N')
{
Samochod s = new Samochod(marka, kolor); //Tworzymy nowy samochód z opisu (klasy)
Console.WriteLine(string.Format("Samochód marki {0} o kolorze {1}", s.Marka, s.Kolor));
}
else
{
Console.WriteLine("Podaj X:");
int x = int.Parse(Console.ReadLine());
Console.WriteLine("Podaj Y:");
int y = int.Parse(Console.ReadLine());
Console.WriteLine("Podaj Z:");
int z = int.Parse(Console.ReadLine());
Console.WriteLine("Podaj Ladowność:");
int ladownosc = int.Parse(Console.ReadLine());
Samochod s = new Samochod(marka, kolor, new Przyczepa(x, y, z, ladownosc));
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment