Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 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 moj
  8. {
  9. class Osoba
  10. {
  11. public string imie, nazwisko, miejsce_zam, najmlodszy;
  12. public int rok_ur,wiek=100;
  13. public void wczytaj()
  14. {
  15. for(int i=0;i<3;i++)
  16. {
  17. Console.Write("Podaj Imie: ");
  18. imie = Console.ReadLine();
  19. Console.Write("Podaj Nazwisko: ");
  20. nazwisko = Console.ReadLine();
  21. Console.Write("Podaj Miejsce Zamieszkania: ");
  22. miejsce_zam = Console.ReadLine();
  23. Console.Write("Podaj wiek: ");
  24. rok_ur = int.Parse(Console.ReadLine());
  25. wypisz();
  26. Wiek();
  27. Console.WriteLine("###########################");
  28. }
  29. }
  30. public void wypisz()
  31. {
  32. if(miejsce_zam=="Sosnowiec")
  33. {
  34. Console.WriteLine(imie + " " + nazwisko + " jest z Sosnowca!");
  35. }
  36. }
  37. public void Wiek()
  38. {
  39. if ((2017-rok_ur) < wiek)
  40. {
  41. wiek = (2017 - rok_ur);
  42. najmlodszy = imie;
  43. Console.WriteLine("Najmlodszy jest " + najmlodszy + " i ma " + wiek + " lat.");
  44. }
  45. }
  46. }
  47.  
  48. class Program
  49. {
  50. static void Main(string[] args)
  51. {
  52. Osoba p1 = new Osoba();
  53. p1.wczytaj();
  54. Console.Read();
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement