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 Task_1
- {
- class Program
- {
- public static Random rnd = new Random();
- static void Main(string[] args)
- {
- do
- {
- Phone[] phones = new Phone[100];
- for (int i = 0; i < phones.Length; i++)
- {
- phones[i] = new Phone(rnd.Next(100, 401));
- }
- for (int i = 0; i < phones.Length; i++)
- {
- for (int j = 0; j < 20; j++)
- {
- if (rnd.Next(100, 401) != phones[i].Number)
- {
- phones[i].AddPhoneToBook(new Phone(rnd.Next(100, 401)));
- }
- else
- {
- phones[i].AddPhoneToBook(new Phone(rnd.Next(100, 401) + 1));
- }
- }
- //phones[i].OnCall += ((int CallerNumber) => Console.WriteLine($"На телефон {phones[i].Number} был совершен звонок с номера {CallerNumber}"));
- }
- for (int i = 0; i < phones.Length; i++)
- {
- phones[i].Call(rnd.Next(100, 401));
- }
- Console.WriteLine("Press any key to continue. Press esc to exit");
- } while (Console.ReadKey().Key != ConsoleKey.Escape);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement