Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int breadNumber;
- int maximumScore = 0;
- string maximumScoreName = "";
- cin >> breadNumber;
- for (int i = 0; i < breadNumber; i++)
- {
- cin.ignore();
- string breadCreator;
- getline(cin, breadCreator);
- int breadTotalGrade = 0;
- string breadGrade;
- cin >> breadGrade;
- while (breadGrade != "Stop")
- {
- breadTotalGrade += stoi(breadGrade);
- cin >> breadGrade;
- }
- cout << breadCreator << " has " << breadTotalGrade << " points." << endl;
- if (breadTotalGrade > maximumScore)
- {
- maximumScore = breadTotalGrade;
- maximumScoreName = breadCreator;
- cout << breadCreator << " is the new number 1! " << endl;
- }
- }
- cout << maximumScoreName << " won competition with " << maximumScore << " points!" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement