Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Lab2
- {
- class Program
- {
- static void Pytanie(string pytanie, int nrPytania)
- {
- Console.WriteLine($"-> Pytanie nr. {nrPytania}: {pytanie}?");
- }
- static bool Odpowiedz()
- {
- return bool.Parse(Console.ReadLine());
- }
- static void wynik(string[] pytania, bool[] odpowiedzi)
- {
- Console.WriteLine("----TWOJE ODPOWIEDZI----");
- Console.WriteLine("");
- for (int i = 0; i < pytania.Length; i++)
- {
- Console.WriteLine($"{pytania[i]}? - {odpowiedzi[i]}");
- }
- }
- static void Main()
- {
- Console.Write("WPISZ IMIĘ: ");
- var imie = Console.ReadLine();
- Console.Clear();
- Console.WriteLine($"----Witaj, {imie}, odowiedz na pytania: true/false----");
- Console.WriteLine("");
- var suma = 0;
- var odpowiedzi = new bool[10];
- var pytania = new string[] {
- "Czy jesteś studentem Politechnik Opolskiej",
- "Czy studiujesz informatyke",
- "Czy programowałeś wcześniej w C#",
- "Czy znasz polecenia SQL",
- "Czy potrafisz rozwiązywać trudne zadania matematyczne",
- "Czy lubisz dużo jeść",
- "Czy lubisz placki",
- "Czy aktywnie spędzasz czas wolny",
- "Czy masz prawo jazdy",
- "Czy masz problem z alkoholem"
- };
- try
- {
- for (int i = 0; i < pytania.Length; i++)
- {
- Pytanie(pytania[i], i);
- odpowiedzi[i] = Odpowiedz();
- }
- }
- catch(Exception exception)
- {
- Console.WriteLine("");
- Console.WriteLine($"@@@ BŁĄD (program zostanie zrestartowany): {exception.Message}");
- Console.WriteLine("");
- Console.ReadKey();
- Console.Clear();
- Main();
- }
- Console.Clear();
- wynik(pytania, odpowiedzi);
- for (int i = 0; i < 5; i++)
- {
- if (odpowiedzi[i])
- {
- suma++;
- }
- }
- Console.WriteLine("");
- Console.WriteLine("");
- if (suma == 5)
- {
- Console.WriteLine($"Witaj {imie} na pokładzie !!!");
- }
- else
- {
- Console.WriteLine("Niestety, Twoje umiejętności są nie wystarczające na to stanowisko.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement