So here is the code:

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

using namespace std;

void printintromessage ();

void getUserInput (char& Y);

//void printplayerinfo (const int& numofgamesinseries, const int& numofplayersonteam, int& i);

int main(int argc, char *argv[])
{
    const int numofgamesinseries = 3;
    const int numofplayersonteam = 4;
    int i,j, score[numofgamesinseries][numofplayersonteam], total = 0, sum = 0;
    char Y = 'Y';
    int k = 1;
    int l = 1;
   
   
    printintromessage ();
   
    getUserInput (Y);
   
    cout <<"Enter scores for team " << k++ << endl;
 [B]do
 {  
  if (Y == 'Y' || Y == 'y')
  {
   for (j = 0; j < numofplayersonteam; j++)
   {
         for (i = 0; i < numofgamesinseries; i++)             
        {
             
              cout << "Enter player " << j+1 << "'s score " << i+1 << ": ";
              cin >> score[i][j];
              
              sum = sum + score[i][j];
        
              if (score [i][j] >= 0 && score [i][j] <= 300)
              {
                 {
                 cout << "Game 1 : " << score [0][0] << endl;
                 cout << "Game 2 : " << score [1][0] << endl;
                 cout << "Game 3 : " << score [2][0] << endl;
                 //cout << "Series : " <<  score[0][0]+score[0][1]+score[0][2] << endl;
                 //cout << "AVG. : " << ((score[0][0]+score[0][1]+score[0][2])/numofgamesinseries) << endl;
                // cout << "" << endl;
                 }
         
               //cout << "Team "<< l++ <<" Totals: " << sum << endl;
               
                 }
               
               else
               
                   {
                   cout << score[i] << " is not a valid score ! Score must be from 0 to 300" << endl;
                   }
               }
               }
               } 
         
      else
         {
          cout << "All finished ? Thank you !" << endl;
         } 
      }
 
 
 while ((Y == 'Y' || Y == 'y'));[/B]
 
    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 printplayerinfo (const int& numofgamesinseries, const int& numofplayersonteam, int& i)
     //{

The problem is in the array, it is not printing correctly or I dont have it set to print correctly, and the do while loop that is in bold red, please any suggestions of how to fix this would be infinitely appreciated! Please help

Edited 6 Years Ago by MTW1989: updating

This is the same issue as your other thread.

http://www.daniweb.com/forums/thread270830.html

I explained what the problem was there. You are using uninitialized variables. I suggested back then that you initialize your arrays to something like -999999 so the lack of initialization will stand out. You can't use uninitialized variables in calculations and you can't print them (you can, but you'll get bad results).

Same suggestion here as there, plus one more.

  1. Read in all the data.
  2. Then do the calculations.
  3. Then display.

Same as VernonDozier said. Also you are printing within the loop itself, so everytimethe user enters the scores, you print all three messages (even when the user has not entered the other ones). So you should print after the second nested loop (the one with i as counter). Also after eachplayer's score has been entered, set sum = 0.
Hope this helps (I don't know if I understood what your problem is exactly, you should attach the output with your code in cases like this)

This article has been dead for over six months. Start a new discussion instead.