Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _4
- {
- class Person
- {
- public string LastName;
- public string FirstName;
- public int Age;
- }
- class Program
- {
- static void Main(string[] args)
- {
- List<Person> people = new List<Person>();
- string name = " ";
- string srname = " ";
- int age;
- while (srname != "exit")
- {
- Console.Write("Введите фамилию: ");
- srname = Console.ReadLine();
- if (srname != "exit")
- {
- Console.Write("Введите имя: ");
- name = Console.ReadLine();
- Console.Write("Введите возраст: ");
- age = Convert.ToInt32(Console.ReadLine());
- Person person = new Person();
- person.LastName = srname;
- person.FirstName = name;
- person.Age = age;
- people.Add(person);
- }
- }
- Console.Write("Введите возраст: ");
- int agev = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < people.Count; i++)
- {
- if (people[i].Age >= agev)
- {
- Console.WriteLine(people[i].FirstName + " " + people[i].LastName +" "+people[i].Age);
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement