Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- int matches = 0, win = 0, lose = 0, draw = 0;
- while (matches < 3)
- {
- string result;
- cin >> result;
- char ch1 = result[0] - 48; char ch2 = result[2] - 48;
- int teamA = ch1; int teamB = ch2;
- if (teamA > teamB){
- win++;
- }
- else if(teamA < teamB){
- lose++;
- }
- else{
- draw++;
- }
- matches++;
- }
- cout << "Team won " << win << " games.\n";
- cout << "Team lost " << lose << " games.\n";
- cout << "Drawn games: " << draw;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement