Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int seats, groupCount, income = 0;
- cin >> seats;
- cin.ignore();
- string command;
- getline(cin, command);
- while (command != "Movie time!") {
- groupCount = stoi(command);
- if (groupCount > seats) {
- break;
- }
- seats -= groupCount;
- income += groupCount * 5;
- if (groupCount % 3 == 0) {
- income -= 5;
- }
- getline(cin, command);
- }
- if (command == "Movie time!") {
- printf("There are %i seats left in the cinema.\n", seats);
- }
- else{
- cout << "The cinema is full.\n";
- }
- printf("Cinema income - %i lv.\n", income);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement