This is what i have for code this far, i need help trying to keep score here. Any help would be well appreciated thanks

``````int sum = 0, teamScore, numPoints, score1 = 0, score2 = 0;

while (teamScore != -999)
{
cout << "Did team 1 or team 2 score? (Enter 1, 2 or -999 to quit): ";
cin >> teamScore;
cout << "How many points did they score? (1, 2, or 3): ";
cin >> numPoints;

if (teamScore ==1 && teamScore != -999)
{
cout << "Team 1" << score1 = sum + numPoints;
cout << "Team 2" << score2 = sum + numPoints;
}
else if (teamScore ==2 && teamScore != -999)
{
cout << "Team 1" << score1 = sum + numPoints;
cout << "Team 2" << score2 = sum + numPoints;
}``````

`if (teamScore ==1 && teamScore != -999)` If team = 1 it can't be -999. Simplify both `if` statements

``````cout << "Team 1" << score1 = sum + numPoints;
cout << "Team 2" << score2 = sum + numPoints;``````

Did they both score the points? Once the output is done, what's the value of `sum` ? Is `sum` important?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.