Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <math.h>
- using namespace std;
- int main()
- {
- string movie;
- getline(cin, movie);
- int studentCounter = 0;
- int standartCounter = 0;
- int kidsCounter = 0;
- cout.setf(ios::fixed);
- cout.precision(2);
- while (movie != "Finish")
- {
- int capacity;
- cin >> capacity;
- int CurrentMovieCnt = 0;
- for (int i = 0; i < capacity; i++)
- {
- string ticketType;
- cin >> ticketType;
- if (ticketType == "End")
- {
- break;
- }
- CurrentMovieCnt++;
- if (ticketType == "student")
- {
- studentCounter++;
- }
- else if (ticketType == "standart")
- {
- standartCounter++;
- }
- else if (ticketType == "kid")
- {
- kidsCounter++;
- }
- }
- double percent = CurrentMovieCnt * 1.0 / capacity * 100;
- cout << movie << " - " << percent << "% full." << endl;
- cin.ignore();
- getline(cin, movie);
- }
- int totalTickets = studentCounter + standartCounter + kidsCounter;
- cout << "Total tickets: " << totalTickets << endl;
- double studentPersent = studentCounter * 1.0 / totalTickets * 100;
- cout << studentPersent << "% standart tickets." << endl;
- double standartPercent = standartCounter * 1.0 / totalTickets * 100;
- cout << standartPercent << "% standart tickets." << endl;
- double kidsPersent = kidsCounter * 1.0 / totalTickets * 100;
- cout << kidsPersent << "% standart tickets." << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement