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)
- {
- string phone = " ";
- int[] table = new Int32[10];
- Console.WriteLine("Программа расчитана на 10 столов, после ввода информации о столах будет возможна бронь");
- for (int i = 0; i < table.Length; i++)
- {
- Console.WriteLine("Введите количество свободных мест за столом № " + (i + 1));
- table[i] = Convert.ToInt32(Console.ReadLine());
- }
- 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пасибо за бронь! Ваши имя и номер телефона будьте добры.");
- phone += (" "+Console.ReadLine());
- }
- else
- Console.WriteLine("Недостаточно мест!");
- Console.WriteLine("За столом " + (userTable + 1) + " Сейчас свободно " + table[userTable] + " Мест. (" + phone + " - " +userPlace +" места. )");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement