Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9.     class Program
  10.     {
  11.         public static string GetStr(string a_sText)
  12.         {
  13.             Console.Write(a_sText);
  14.             return Console.ReadLine();
  15.         }
  16.  
  17.         public static int GetInt(string a_sText)
  18.         {
  19.             Console.Write(a_sText);
  20.             return int.Parse(Console.ReadLine());
  21.         }
  22.  
  23.         public static float GetFloat(string a_sText)
  24.         {
  25.             Console.Write(a_sText);
  26.             return float.Parse(Console.ReadLine());
  27.  
  28.         }
  29.  
  30.         static void Main(string[] args)
  31.         {
  32.             Osoba osoba = new Osoba();
  33.  
  34.             while (true)
  35.             {
  36.                 try
  37.                 {
  38.                     osoba.Imie = GetStr("Podaj Imie ");
  39.                     osoba.Nazwisko = GetStr("Podaj Nazwisko");
  40.                     osoba.Wiek = GetInt("Podaj wiek:");
  41.                     osoba.Waga = GetFloat("Podaj Wage");
  42.                     osoba.Wzrost = GetFloat("Podaj Wzros");
  43.  
  44.                     Console.WriteLine(" Witam " + osoba.Imie + " Twoje BMI wynosi: " + osoba.Bmi);
  45.  
  46.                     break;
  47.                 }
  48.                 catch (Exception e)
  49.                 {
  50.                     Console.WriteLine(e.Message);
  51.                 }
  52.  
  53.             }
  54.  
  55.  
  56.  
  57.             Console.ReadKey();
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement