Please, I need some help with my hw. I have to create a program that stores the scores for a football team. I need to record the score by quarter for each of the 20 games. I have to initialize all games to 0.
Then, the user is asked to enter the number of game he wants to update. The scores are created with a random number generator.
An example of the output can be like this:
Enter the number of game you wish to update: Game # 3
Do you wish to enter another game to update? If not, enter 0. Game#4
Do you wish to enter another game to update? If not, enter 0. Game#17
Do you wish to enter another game to update? If not, enter 0. Game#0
Game # Quarter 1 Quarter 2 Quarter 3 Quarter 4 Total
3 0 7 3 0 10
4 6 0 13 0 19
17 21 3 0 6 30
Final totals 123 231 321 431 345
Here is what I have so far, but I don't know what else to do :confused:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int game[20] [4];
for(int g=0; g<20;g++)
for (int q =0; q<4; q++)
game[g] [q] = 0;
int randomInteger;
srand((unsigned) time(0));
randomInteger = (rand()%33);
int g;
cout<<"Enter the number of game you wish to update: Game #";
cin>>g;
do
{
cout<<"Do you wish to enter another game to update? If not, enter 0. Game#";
cin>>g[];
} while (g != 0);
cout<<"Quarter 1 "<<"Quarter 2 "<<"Quarter 3 "<<"Quarter 4"<<endl;
for (int q = 0; q<4; q++)
game[g-1] [q] = randomInteger;
for (int i = 0; i<4; i++)
cout<<game[g-1] [i]<<" ";
cout<<endl<<endl;
cin.get();
cin.get();
return 0;
}
Thank you for you help.