Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Ijunior
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Queue<int> customers = new Queue<int>();
- int sum = 0;
- int offsetInfo = 40;
- int currenCustomer;
- FillQueue(customers);
- while (customers.Count > 0)
- {
- currenCustomer = customers.Dequeue();
- sum += currenCustomer;
- Console.SetCursorPosition(0, 0);
- Console.WriteLine("Текущий покупатель: " + currenCustomer);
- foreach (var customer in customers)
- {
- Console.WriteLine(customer);
- }
- Console.SetCursorPosition(offsetInfo, 0);
- Console.WriteLine("Общая сумма: " + sum);
- Console.ReadKey();
- Console.Clear();
- }
- }
- static void FillQueue(Queue<int> queue)
- {
- Random random = new Random();
- int minRandomNumber = 10;
- int maxRandomNumber = 100;
- int countCustomers = 10;
- for (int i = 0; i < countCustomers; i++)
- {
- queue.Enqueue(random.Next(minRandomNumber, maxRandomNumber));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment