#include <iostream>
#include <string.h>
using namespace std;
main(){
string team1, team2;
int p1, p2;
for (int j=1; j<=4; j++)
{
cout << "GAME " << j << "\n";
cout << "Input Team 1 name: ";
cin >> team1;
cout << "Input Team 2 name: ";
cin >> team2;
for (int i=1; i<=3; i++)
{
cout << "Round " << i << ": " << endl;
cout << "\tTeam " << team1 << " Points: ";
cin >> p1;
cout << "\tTeam " << team2 << " Points: ";
cin >> p2;
cout << "================================\n";
if (p1 > p2)
{
cout << "Winner: Team " << team1 << endl;
}
else if (p1 < p2)
{
cout << "Winner: Team " << team2 << endl;
}
else
{
cout << "No winner\n";
}
}
}
}
natry ko na rin po ang std::cin. prefer ko po sana yung may space ang mga teams if ever, instructed din ng instructorBale ito po yung fix sa problem niyo po.
C++:#include <iostream> #include <string.h> using namespace std; main(){ string team1, team2; int p1, p2; for (int j=1; j<=4; j++) { cout << "GAME " << j << "\n"; cout << "Input Team 1 name: "; cin >> team1; cout << "Input Team 2 name: "; cin >> team2; for (int i=1; i<=3; i++) { cout << "Round " << i << ": " << endl; cout << "\tTeam " << team1 << " Points: "; cin >> p1; cout << "\tTeam " << team2 << " Points: "; cin >> p2; cout << "================================\n"; if (p1 > p2) { cout << "Winner: Team " << team1 << endl; } else if (p1 < p2) { cout << "Winner: Team " << team2 << endl; } else { cout << "No winner\n"; } } } }