Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- int main() {
- string team, result;
- getline(cin, team);
- int matchCount, won = 0, drawn = 0, lost = 0;
- cin >> matchCount;
- for (int i = 0; i < matchCount; i++) {
- cin >> result;
- if (result == "W") {
- won++;
- }
- else if (result == "D") {
- drawn++;
- }
- else {
- lost++;
- }
- }
- if (matchCount == 0) {
- cout << team << " hasn't played any games during this season.\n";
- }
- else {
- cout << team << " has won " << won * 3 + drawn << " points during this season.\n"
- << "Total stats:\n"
- << "## W: " << won << "\n"
- << "## D: " << drawn << "\n"
- << "## L: " << lost << "\n"
- << "Win rate: " << fixed << setprecision(2) << 100.0 * won / matchCount << "%\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement