Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string tournament;
- getline(cin, tournament);
- int won = 0, lost = 0, games, team1, team2;
- while (tournament != "End of tournaments") {
- cin >> games;
- for (int game = 1; game <= games; game++) {
- cin >> team1 >> team2;
- if (team1 > team2) {
- cout << "Game " << game << " of tournament " << tournament << ": win with " << team1 - team2 << " points.\n";
- won++;
- }
- else {
- cout << "Game " << game << " of tournament " << tournament << ": lost with " << team2 - team1 << " points.\n";
- lost++;
- }
- }
- cin.ignore();
- getline(cin, tournament);
- }
- printf("%.2f%% matches win\n", 1.0 * won / (won + lost) * 100);
- printf("%.2f%% matches lost\n", 1.0 * lost / (won + lost) * 100);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement