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 ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] table = { 6, 10, 2, 4 };
- while (true)
- {
- Console.WriteLine("Все столы в зале:");
- for (int i = 0; i < table.Length; i++)
- {
- Console.WriteLine("Cтол № " + (i + 1) + " Свободных мест: " + table[i]);
- }
- Console.WriteLine("Какой стол вы хотите забронировать? ");
- int userTable = Convert.ToInt32(Console.ReadLine()) - 1;
- if(userTable > table.Length - 1)
- {
- Console.WriteLine("такого стола нет.");
- continue;
- }
- Console.WriteLine("Сколько мест вым нужно? ");
- int userPlace = Convert.ToInt32(Console.ReadLine());
- if (table[userTable] >= userPlace && userPlace > 0)
- {
- table[userTable] -= userPlace;
- Console.WriteLine("Cпасибо за бронь!");
- }
- else
- Console.WriteLine("Недостаточно мест!");
- Console.WriteLine("За столом " + (userTable + 1) + "Сейчас свободно " + table[userTable] + " Мест.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement