SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include <cmath> | |
| 3 | #include <string> | |
| 4 | ||
| 5 | using namespace std; | |
| 6 | ||
| 7 | int main() | |
| 8 | {
| |
| 9 | int matches = 0, win = 0, lose = 0, draw = 0; | |
| 10 | ||
| 11 | while (matches < 3) | |
| 12 | {
| |
| 13 | string result; | |
| 14 | cin >> result; | |
| 15 | ||
| 16 | - | char ch = result[0] - 48; char ch1 = result[2] - 48; |
| 16 | + | char ch1 = result[0] - 48; char ch2 = result[2] - 48; |
| 17 | ||
| 18 | - | int team = ch; int team1 = ch1; |
| 18 | + | int teamA = ch1; int teamB = ch2; |
| 19 | ||
| 20 | - | if (team > team1){
|
| 20 | + | if (teamA > teamB){
|
| 21 | win++; | |
| 22 | } | |
| 23 | - | else if(team < team1){
|
| 23 | + | else if(teamA < teamB){
|
| 24 | lose++; | |
| 25 | } | |
| 26 | else{
| |
| 27 | draw++; | |
| 28 | } | |
| 29 | ||
| 30 | matches++; | |
| 31 | } | |
| 32 | cout << "Team won " << win << " games.\n"; | |
| 33 | ||
| 34 | cout << "Team lost " << lose << " games.\n"; | |
| 35 | ||
| 36 | cout << "Drawn games: " << draw; | |
| 37 | } |