Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace darkinjector {
- class Program {
- static void Main(string[] args) {
- bool[] seats = { false, false, false, false, false, false, false, false, false, false };
- int count = 0;
- while (count < seats.Length) {
- Console.Write("B, E or X: ");
- string input = Console.ReadLine();
- if (input.Length == 0) continue;
- char c = input.ToUpper()[0];
- int start;
- if (c == 'B')
- start = 0;
- else if (c == 'E')
- start = 4;
- else if (c == 'X')
- break;
- else
- continue;
- if (start == -1) break;
- while (seats[start]) start = (start + 1) % seats.Length;
- seats[start] = true;
- string seatName = start >= 4 ? "Economy" : "Business";
- Console.WriteLine("You were given seat {0} ({1})", start, seatName);
- count++;
- }
- for (int i = 0; i < seats.Length; i++) {
- Console.WriteLine(seats[i]);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment