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 Cinema_Tickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int students = 0;
- int standarts = 0;
- int kids = 0;
- string name = Console.ReadLine();
- while (name != "Finish")
- {
- int n = int.Parse(Console.ReadLine());
- int count = 0;
- for (int i = 0; i < n; i++)
- {
- string type = Console.ReadLine();
- if (type == "End")
- break;
- switch (type)
- {
- case "student":
- students++;
- break;
- case "standard":
- standarts++;
- break;
- case "kid":
- kids++;
- break;
- }
- count++;
- }
- Console.WriteLine("{0} - {1:f2}% full.", name, (double)count * 100 / n);// Правим едно от числата double.
- name = Console.ReadLine();
- }
- int all = students + standarts + kids;
- Console.WriteLine("Total tickets: " + all);
- Console.WriteLine("{0:f2}% student tickets.", 100 * (double)students / all);// Правим едно от числата double. Няма точка и процент.
- Console.WriteLine("{0:f2}% standard tickets.", (double)standarts * 100 / all);// Правим едно от числата double. Няма точка.
- Console.WriteLine("{0:f2}% kids tickets.", kids * 100 / (double)all);// Правим едно от числата double. Няма точка.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement