ok it almosts works, the program stops when i enter the first at_BAT AND then hits and wont loop to get the neext persons at bat and hits.

error:

36 no matching function for call to `toupper(std::string&)' 

ok here is ther part that isnt working...

for (int i = 0; i < count ; i++)
{
cout << "\n\n\n\n";
cout <<"Please Enter At bats";
cin >> At_Bat;
cout <<"Please Enter total hita";
cin >> Hit;

while (At_Bat >= Hit);
Array_avg[Average] = Hit/At_Bat;

}


}

and this is whole code....

#include <iostream>    
#include <string>
#include <cctype>  
#include <iomanip>
using namespace std;

//function prototype goes outside main
string format_name(string Name);

int main()
{
    string Name = "";

    //local constants
    int Average = 0;
    int At_Bat = 0;
    int Hit = 0;
    const int MAX = 100;
    string QUIT = "Q";  


    //local variables   
    string Array_names[MAX] = {""};
    int Array_avg[MAX] = {0};




/*****************************************************************/
int count = 0;
for (count = 0; count <= 10 ; count ++)
{    
     cout <<"\n\n\n\n\n";    
     cout << setw(60) << "Please enter player name, or Q to quit";    
     cout << "\n";
     QUIT = toupper (QUIT);
     cin >> Name;   

     if(Name == QUIT) 
     break; //exit the loop 
      else{          

            //call function to put name in array    
            Array_names[count] = format_name(Name);      
            }  
}
/*********************************************************/

for (int i = 0; i < count ; i++)
{
cout << "\n\n\n\n";
cout <<"Please Enter At bats";
cin >> At_Bat;
cout <<"Please Enter total hita";
cin >> Hit;

while (At_Bat >= Hit);
Array_avg[Average] = Hit/At_Bat;

}


}


/**********************************************************************
 *Program Name   : 
 *Author         : 
 *Date           : 
 *Course/Section : CSC 110
 *Program Description:  This function is designed to format a string
 *  to be 12 characters long.  If the string is longer than 12 chars
 *  then the string will be truncated.  If the string is shorter than 
 *  12 characters then it will be padded with spaces at the end.
 *
 *BEGIN - Format Name (input string)
 *   Init pad variable to # of chars the name is too long or too short
 *   IF (input string is too short)
 *      Pad the string with spaces
 *   ELSE //input string is too long
 *      Truncate the unwanted characters
 *   END IF
 *   Return the new formatted string
 *END - Format Name
 *********************************************************************/

string format_name(string Name)
{
    //local constants
    const int WIDTH = 12;

    //local variables
    int Pad = WIDTH - Name.length(); //# of chars too long or too short

    /***********begin function body*****************************/

    //if the name is shorter than the desired width
    if (Pad > 0)

        //pad the name with spaces so the length is correct
        for (int Count = 0; Count < Pad; Count++)
            Name = Name + " ";

    else //the name is longer than the desired width

        //truncate all characters after the desired width
        Name = Name.substr(0, WIDTH);

    //return the new string
    return Name;

}//end format name

I have not taken a closer look at your code, so i'm not sure what you are trying to do but...

There is a BIG problem right here:

while (At_Bat >= Hit);

IF the condition evaluates to true, you are entering an infinite loop.

im trying make it so entering the at_bats and hits will get and average then store in array.

for (int i = 0; i < count ; i++)
{
cout << "\n\n\n\n";
cout <<"Please Enter At bats";
cin >> At_Bat;
cout <<"Please Enter total hits";
cin >> Hit;

while (i < count)

if (At_Bat >= Hit);
Array_avg[] = Hit/At_Bat;
 
 else  (Array_avg[MAX])
 cout << Array_avg();
 
}


}

Listen to the error : "no matching function for call to `toupper(std::string&)' "

It tells you that there is no function that matches the prototype :
toupper(std::string&). There is however, toupper(char ch);

You will need to make a toupper(std::string&) function , using toupper(char ch).

maybe something like this :

void toUpper(std::string& str){
for i = 0  and i < str.size() , i++){
   str at i = toupper(str at i );
   }
}
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.