#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>

using namespace std;

void printintromessage ();

void getUserInput (char& Y);

void calculations (const int& numofgamesinseries, const int& numofplayersonteam, int& i, int& j, int& k, int& l, char& Y);

void PrintMax (const int& numofgamesinseries, const int& numofplayersonteam, int& i, int& j);

int main(int argc, char *argv[])
{
    const int numofplayersonteam = 4;
    const int numofgamesinseries = 3;
   
    int k = 1;
    int l = 1;  
    int i,j; 
    int score[numofplayersonteam][numofgamesinseries];
    char Y = Y;
    
   
   
    printintromessage ();
   
 do
 {  
  calculations (numofgamesinseries, numofplayersonteam, i, j, k, l, Y);
  }
      
 
 
 while ((Y == 'Y' || Y == 'y'));
 
    system("PAUSE");
    return EXIT_SUCCESS;
}


void printintromessage ()
     {
     cout << "This program processes bowling scores." << endl;
     cout << "The user is asked to enter 3 bowling scores" << endl;
     cout << "for each person on the team. There are 4 people" << endl;
     cout << "per team. After all the scores are entered" << endl;
     cout << "for a player, the program will list the individual" << endl;
     cout << "game scores,the player's total score (series), and" << endl;
     cout << "the player's average.After each team's input is complete," << endl;
     cout << "the program will list the team's total scores by game," << endl;
     cout << "the team's total score (series)and the team's average." << endl;
     cout << "The user will then be asked if he/she wants to" << endl;
     cout << "enter more data. If not, the program will list the" << endl;
     cout << "team with the highest total score (series) and that " << endl;
     cout << "total. If the user wants to enter more data," << endl;
     cout << "the above process is repeated." << endl;
     cout << " " << endl;
     }
    
void getUserInput (char& Y)
      {
      cout << "Do you want to enter (more) data?" << endl;
      cout << "Enter Y to continue, anything else to quit: ";           
      cin >> Y;
      cout << " " << endl;
      }  
     
void calculations (const int& numofgamesinseries, const int& numofplayersonteam, int& i, int& j, int& k, int& l, char& Y)
     {
                
       int score[numofplayersonteam][numofgamesinseries];           
       getUserInput (Y);
       
       if (Y == 'Y' || Y == 'y')
       {
        
        cout <<"Enter scores for team " << k++ << endl;
   
        for (i= 0; i < numofplayersonteam; i++)
        {
         for (j = 0; j < numofgamesinseries; j++)
          {      
              cout << "Enter player " << i+1 << "'s score " << j+1 << ": ";
              cin >> score[i][j];
                
          } 
              //if (score [i][j] >= 0 && score [i][j] <= 300)
              //{          
              cout <<"Game 1: " << score [i][0] << endl;
              cout <<"Game 2: " << score [i][1] << endl;
              cout <<"Game 3: " << score [i][2] << endl; 
              cout << "Series: " << score [i][0] + score [i][1] + score [i][2] << endl;
              cout << "AVG. : " << ((score[i][0]+score[i][1]+score[i][2])/numofgamesinseries) << endl; 
              cout << " " << endl;
                   
         }
                   
              cout << " " << endl;
              cout << "Team " << l++ <<" Totals: " << endl;
              cout << "Game 1: " << (score [0][0] + score [1][0] + score [2][0] + score [3][0]) << endl;
              cout << "Game 1: " << (score [0][1] + score [1][1] + score [2][1] + score [3][1]) << endl;
              cout << "Game 1: " << (score [0][2] + score [1][2] + score [2][2] + score [3][2]) << endl;
              cout << "Series: " << (score [0][0] + score [1][0] + score [2][0] + score [3][0] + score [0][1] + score [1][1] + score [2][1] + score [3][1] + score [0][2] + score [1][2] + score [2][2] + score [3][2]) << endl;
              cout << "AVG. : " << ((score [0][0] + score [1][0] + score [2][0] + score [3][0] + score [0][1] + score [1][1] + score [2][1] + score [3][1] + score [0][2] + score [1][2] + score [2][2] + score [3][2])/numofgamesinseries) << endl;
              cout << " " << endl;
        }
      
      else
         {
          cout << "All finished ? Thank you !" << endl;
          PrintMax (numofgamesinseries, numofplayersonteam, i, j);
         }            

   } 
         
 void PrintMax (const int& numofgamesinseries, const int& numofplayersonteam, int& i, int& j)
 {
  int score[numofplayersonteam][numofgamesinseries];    
  cout << "The Highest Score is: " << score [0][0] << endl;    
 }

Here is the code, I have the multiarray now working, but not sure how and where to check for valid input (score of 0 to 300). Also how would I output the highest series score, as in Team 2 had the highest score of 2202??

for (j = 0; j < numofgamesinseries; j++) { 
cout << "Enter player " << i+1 << "'s score " << j+1 << ": "; 
cin >> score[i][j]; 
if (score[i][j] < 0 || score[i][j] > 300)
{
cout << "You entered an invaild score of : " << score[i][j] << "\n"
<< "Scores must be between 0 and 300, please try again\n"
j-- // back up j by one (so the loop will run again rewriting old data)
}
}

probably a better way to do it but that should work without altering your code

Maybe my code is wrong, but when I add that it throws off my code an causes it to output garbage values.

Maybe my code is wrong, but when I add that it throws off my code an causes it to output garbage values.

weird i just copied you program on my computer and tried my code and it worked. Comment you code out and copy and paste this. if you works you know it was a typo some where

for (i= 0; i < numofplayersonteam; i++)
  
      {
  
      for (j = 0; j < numofgamesinseries; j++)
  
      {
  
      cout << "Enter player " << i+1 << "'s score " << j+1 << ": ";
  
      cin >> score[i][j];
  
       if (score[i][j] < 0 || score[i][j] > 300)
       {
            cout << "Score must be between 0 and 300, please try again.\n";
            j--;
       }
  
      }

Oops... You were right the 1st time i just pasted it wrong sorry, and thank you so much for the help I was beating my head against the wall

If it is not too much would you happen to know how id print the highest series score? such as team 1 has 100 and team 2 has 2200, And at the end where it says print max will print 2200

just take the series scores you output at compare them for the max and out that.

ok thank you so much dude.

ok thank you so much dude.

no problem, unless you have any other questions make sure to mark this thread as solved. That way everyone will know to skip over this tread and help someone else.

Be a part of the DaniWeb community

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