Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace moj
- {
- class Osoba
- {
- public string imie, nazwisko, miejsce_zam, najmlodszy;
- public int rok_ur,wiek=100;
- public void wczytaj()
- {
- for(int i=0;i<3;i++)
- {
- Console.Write("Podaj Imie: ");
- imie = Console.ReadLine();
- Console.Write("Podaj Nazwisko: ");
- nazwisko = Console.ReadLine();
- Console.Write("Podaj Miejsce Zamieszkania: ");
- miejsce_zam = Console.ReadLine();
- Console.Write("Podaj wiek: ");
- rok_ur = int.Parse(Console.ReadLine());
- wypisz();
- Wiek();
- Console.WriteLine("###########################");
- }
- }
- public void wypisz()
- {
- if(miejsce_zam=="Sosnowiec")
- {
- Console.WriteLine(imie + " " + nazwisko + " jest z Sosnowca!");
- }
- }
- public void Wiek()
- {
- if ((2017-rok_ur) < wiek)
- {
- wiek = (2017 - rok_ur);
- najmlodszy = imie;
- Console.WriteLine("Najmlodszy jest " + najmlodszy + " i ma " + wiek + " lat.");
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Osoba p1 = new Osoba();
- p1.wczytaj();
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement