Programming Basics Online Exam - 20 and 21 April 2019, задача: 06. Easter Competition
https://softuni.bg/downloads/svn/programming-basics-v4/course-directories/may-2019/2019-03/Exam/06.%20Easter%20Competition.pdf
Бихте ли ми помогнали да реша задачата като използвам getline функцията за четене на вход. Задачата я решавам без getline, но не вземам всички точки. Ето решението ми:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int numbCakes, maxPoints = 0;
cin >> numbCakes;
string nameWinner;
for (int i = 0; i < numbCakes; i++)
{
string nameChef;
cin >> nameChef;
int sumPoints = 0;
string pointsAsStr;
cin >> pointsAsStr;
while (pointsAsStr != "Stop")
{
int points = stoi(pointsAsStr);
sumPoints += points;
cin >> pointsAsStr;
}
cout << nameChef << " has " << sumPoints << " points." << endl;
if (sumPoints > maxPoints)
{
maxPoints = sumPoints;
nameWinner = nameChef;
cout << nameChef << " is the new number 1!" << endl;
}
}
cout << nameWinner << " won competition with " << maxPoints << " points!" << endl;
return 0;
}