### Another Problem

This program involves a for loop as well. But only has to record the score of team a and b for each quarter for a total of 4 quarters. I get it to compile, just getting some really big numbers. Any suggestions?

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` ``````// Lab0904.cpp - // Created by Taft Sanders on 10/12/12 #include using namespace std; int main( ) { int scoreA; int scoreB; int teamA; int teamB; for (int quarter=1; quarter<=4; quarter++) { cout<< "What is the score of Team A: "; cin>>teamA; cout<< "What is the score of Team B: "; cin>>teamB; } scoreA=scoreA+teamA; scoreB=scoreB+teamB; cout<< "Final Scores: "<scoreB) { cout<<"Team A won!"<

 ``` What is the score of Team A: 25 What is the score of Team B: 20 What is the score of Team A: 22 What is the score of Team B: 24 What is the score of Team A: 20 What is the score of Team B: 31 What is the score of Team A: 29 What is the score of Team B: 28 Final Scores: Team A: 1965596241 Team B: 2686820 Team A won! Press any key to continue . . . ```
Ok I guess it just took a little longer playing and I would have figured it out. Thanks to anyone that may be working on this currently. I'll post the code for those that may care to critique my results.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849`` ``````// Lab0904.cpp - // Created by Taft Sanders on 10/12/12 #include using namespace std; int main( ) { int scoreA=0; int scoreB=0; int teamA; int teamB; for (int quarter=1; quarter<=4; quarter++) { cout<< "What is the score of Team A: "; cin>>teamA; cout<< "What is the score of Team B: "; cin>>teamB; scoreA=scoreA+teamA; scoreB=scoreB+teamB; } cout<< "Final Scores: "<scoreB) { cout<<"Team A won!"<

 ``` What is the score of Team A: 25 What is the score of Team B: 20 What is the score of Team A: 22 What is the score of Team B: 24 What is the score of Team A: 20 What is the score of Team B: 31 What is the score of Team A: 29 What is the score of Team B: 28 Final Scores: Team A: 96 Team B: 103 Team B won! Press any key to continue . . . ```
Topic archived. No new replies allowed.