Hello, I tried to make game where you can determine the winner by inputting their scores
i'm just confuse how to count the wins of one team
here's my code:
#include <iostream>
#include <string.h>
using namespace std;
main(){
int p1, p2, a=4;
int wincount=0;
string team1, team2;
for (int j=0; j<a; j++)
{
cout << "GAME " << j+1 << "\n";
cout << "Input Team 1 name: ";
cin >> team1;
cout << "Input Team 2 name: ";
cin >> team2;
for (int v=1; v<=3; v++)
{
cout << "Round " << v << ": " << endl;
cout << "\tTeam " << team1 << " Points: ";
cin >> p1;
cout << "\tTeam " << team2 << " Points: ";
cin >> p2;
cout << "================================\n";
if (p1 > p2)
{
cout << "Winner: Team " << team1 << endl;
wincount += 1;
}
else if (p1 < p2)
{
cout << "Winner: Team " << team2 << endl;
wincount += 1;
}
else
{
cout << "No winner\n";
}
}
cout << "Team " << team1 << ": " << wincount << "wins(s)" << endl;
cout << "Team " << team2 << ": " << wincount << "wins(s)" << endl;
cout << "Game " << j+1 << "Winner: ";
}
//cout << "Summary of winners: ";
//for (int i=1; i<a; ++i)
//{
// for(int v=i+1;v<a:v++)
// {
//
// }
//}
}
i'm also confuse how to enlist the winners in 3 games as indicated inside the for loop, those slashes are my trial and error but no luck.
any help is appreciated
PS: I don't use, void, public, class, struggle or anything advance c++ topics