heya couple errors in this code, not really sure what to do...

line 30 expected constructor, destructor, or type conversion before '(' token
line 30 expected `,' or `;' before '(' token
line 32 expected constructor, destructor, or type conversion before '<<' token
line 32 expected `,' or `;' before '<<' token
line 33 expected constructor, destructor, or type conversion before '<<' token
line 33 expected `,' or `;' before '<<' token

int count = 0;
for (count = 0; count <= 10 ; count ++) 
{
    cout <<"\n\n\n\n";
    cout << setw(60) <<"Please enter player name, or Q to quit";
    cin >> Name;
    if(Name == QUIT) {break;} //exit the loop
  else{
          //call function to put name in array
	Array_names[count] = format_name(Name); 
     }
}

     cout << setw(58)<<"Enter the number of At Bats";
     cin >> At_Bat ;
     cout << setw(59) << "Enter the number of times player hit the ball";
     if(At_Bat >= Hit)
     {
     cout << setw(39)<< "Error";
     }
     
   
     else if (At_Bat <= Hit)
              {
                    Array_avg[Average] = Hit/At_Bat;
               }


}
//Clear Screen
	system("cls");
//display
cout << setw(56) <<"Team Batting Average";
cout << setw(19) << Array_name << setw(39) << Array_avg;

Recommended Answers

All 2 Replies

Well, what is that brace on line 29 closing? Nothing. Your other for closes on line 12. Is there some kind of brace matching in whatever editor you are using? You can use that to run through them.

Also, more importantly, you can't just use << with arrays. You need to write a for loop to print out the individual members.

i hsve this now... what changes do i make so it'll work correctly

int count = 0;
for (count = 0; count <= 10 ; count ++) 
{
    cout <<"\n\n\n\n";
    cout << setw(60) <<"Please enter player name, or Q to quit";
    cin >> Name;
    if(Name == QUIT) {break;} //exit the loop
  else{
          //call function to put name in array
	Array_names[count] = format_name(Name); 
     }
}

     cout << setw(58)<<"Enter the number of At Bats";
     cin >> At_Bat ;
     cout << setw(59) << "Enter the number of times player hit the ball";
     if(At_Bat >= Hit)
     {
     cout << setw(39)<< "Error";
     }
     
   
     else if (At_Bat <= Hit)
              {
                    Array_avg[Average] = Hit/At_Bat;
               }



//Clear Screen
	system("cls");
//display
for(int i; i <= MAX; i++)
{
cout << setw(56) <<"Team Batting Average";
cout << setw(19) << Array_names[i] << setw(39) << Array_avg[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.