Created
April 18, 2018 06:46
-
-
Save pmikstacki/9374281a6eef5ab87fdc6d9e1aad6d49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main | |
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");} | |
//} | |
Console.WriteLine(string.Format("Samochód marki {0} o kolorze {1}", s.Marka, s.Kolor)); | |
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) | |
} | |
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