Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string command, bestPlayer;
- getline(cin, command);
- int currentPlayerGoals, bestPlayerGoals = 0;
- while (command != "END" && bestPlayerGoals < 10) {
- string currentPlayer = command;
- cin >> currentPlayerGoals;
- if (currentPlayerGoals > bestPlayerGoals) {
- bestPlayer = currentPlayer;
- bestPlayerGoals = currentPlayerGoals;
- }
- cin.ignore();
- getline(cin, command);
- }
- cout << bestPlayer<< " is the best player!\n";
- if (bestPlayerGoals < 3) {
- cout << "He has scored " << bestPlayerGoals << " goals.\n";
- }
- else{
- cout << "He has scored " << bestPlayerGoals << " goals and made a hat-trick !!!\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement