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()
- {
- int points;
- cin >> points;
- cin.ignore();
- int totalThrows = 0;
- while (points > 0) {
- totalThrows++;
- string sector;
- getline(cin, sector);
- if (sector == "bullseye") {
- cout << "Congratulations! You won the game with a bullseye in " << totalThrows << " moves!";
- return 0;
- }
- int hitPoints;
- cin >> hitPoints;
- cin.ignore();
- //if (sector == "number section") {
- // hitPoints *= 1;
- //}else
- if (sector == "double ring") {
- hitPoints *= 2;
- }
- else if (sector == "triple ring") {
- hitPoints *= 3;
- }
- points -= hitPoints;
- }
- if (points == 0) {
- cout << "Congratulations! You won the game in " << totalThrows << " moves!";
- }
- else {
- cout << "Sorry, you lost. Score difference: " << abs(points) << ".";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement