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 ConsoleApp2
- {
- class Person
- {
- public string name;
- public string hairColor;
- public int shoesSize;
- public int height;
- public int age;
- public void PrintDetails()
- {
- Console.WriteLine("{0} kurio plauku spalva {1} , batu dydis {2}, ugis {3}, amzius {4}", name, hairColor, shoesSize, height, age);
- }
- }
- class Program
- {
- static void PrintHumanDetails(Person person)
- {
- Console.WriteLine("{0} kurio plauku spalva {1} , batu dydis {2}, ugis {3}, amzius {4}", person.name, person.hairColor, person.shoesSize, person.height, person.age);
- }
- static void Main(string[] args)
- {
- // zmogus: vardas, plauku spalva, batu dydis, ugis
- Person tomas = new Person();
- tomas.name = "Tomas";
- tomas.hairColor = "juodi";
- tomas.shoesSize = 40;
- tomas.height = 185;
- tomas.age = 21;
- Person petras = new Person();
- petras.name = "Petras";
- petras.hairColor = "blondinas";
- petras.shoesSize = 20;
- petras.height = 170;
- petras.age = 24;
- tomas.PrintDetails();
- PrintHumanDetails(petras);
- Console.ReadKey();
- }
- static string Ask(string question)
- {
- string variable = "";
- while (variable == "")
- {
- Console.Clear();
- Console.WriteLine(question);
- variable = Console.ReadLine();
- }
- return variable;
- }
- static int AskNumber(string question)
- {
- int number = 0;
- do
- {
- Console.Clear();
- Console.WriteLine(question);
- } while (!int.TryParse(Console.ReadLine(), out number));
- return number;
- }
- }
- }
Add Comment
Please, Sign In to add comment