Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string name, zone;
- getline(cin, name);
- cin >> zone;
- int dots, yesCount = 0, noCount = 0, total = 301;
- while (zone != "Retire") {
- cin >> dots;
- if (zone == "Double") {
- dots *= 2;
- }
- else if (zone == "Triple") {
- dots *= 3;
- }
- if (total < dots) {
- noCount++;
- }
- else {
- total -= dots;
- yesCount++;
- }
- if (total == 0) {
- break;
- }
- cin >> zone;
- }
- if (total == 0) {
- cout << name << " won the leg with " << yesCount << " shots.\n";
- }
- else {
- cout << name << " retired after " << noCount << " unsuccessful shots.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement