Can any one please help me figure out what I am doing wrong on the following C++ programing language? I couldn't figure out what I am doing wronge that it gave me a hard time to compile it. Here is what I have done so far.

using namespace std;  

struct grades  
{
       double total;  
       double quiz_value, score_quiz1, score_quiz2;  
       double midterm_value, score_midterm;  
       double final_value, score_final;  


};  

 void final_grade(grades& the_grades);  
 int main()   
 {
     grades data;  
     final_grade(data);  
     double quiz_value, midterm_value, final_value;  
     quiz_value = (data.score_quiz1 + data.score_quiz2)*(.25);  
     midterm_value =(data.score_midterm * .25);  
     final_value = (data.score_final * .50);  
     data.total = (quiz_value + midterm_value + final_value);  
     cout.setf(ios::fixed);  
     cout.setf(ios::showpoint);  
     cout.precision(2);  
     cout << "The accumlative score is: " 
          << data.total << endl;   

     return 0;  

}  
 void final_grade(grades& the_grades);  

{
      cout << "Enter the score of the first quiz: ";  
      cin >> the_grades.score_quiz;  
      cout << "Enter the score of the second quiz";   
      cin >> the_grades.score_quiz2;  
      cout << "Enter the score of the midterm";  
      cin >> the_grades.score_midterm;  
      cout << "Enter the score of the final";  
      cin >> the_grades.score_final;  
}  
 char letterGrade (double numericGrade)  

{
      char letter;  
      if (numericGrade < 60)  
      letter = 'F';  
      else if (numericGrade < 70)  
      letter = 'D';  
      else if (numericGrade < 80)  
      letter = 'C';  
      else if (numericGrade < 90)  
      letter = 'B';  
      else 
      letter = 'A';  

   return letter;  
}

// The error message I get is 
// expected unqualified-id before '{'token
// expected `,' or `;' before '{' token
void final_grade(grades& the_grades); 
{
  cout << "Enter the score of the first quiz: ";

Try removing the ; at the end of the first line posted above.

Not only that semi-colon but also look at your braces in your function: (I marked things in red)

void final_grade(grades& the_grades)[B];[/B] 

{
cout << "Enter the score of the first quiz: "; 
cin >> the_grades.score_quiz; 
cout << "Enter the score of the second quiz"; 
cin >> the_grades.score_quiz2; 
cout << "Enter the score of the midterm"; 
cin >> the_grades.score_midterm; 
cout << "Enter the score of the final"; 
cin >> the_grades.score_final; 
[B]} [/B]
char letterGrade (double numericGrade) 

[B]{[/B]
char letter; 
if (numericGrade < 60) 
letter = 'F'; 
else if (numericGrade < 70) 
letter = 'D'; 
else if (numericGrade < 80) 
letter = 'C'; 
else if (numericGrade < 90) 
letter = 'B'; 
else 
letter = 'A'; 

return letter; 
}

// The error message I get is 
// expected unqualified-id before '{'token
// expected `,' or `;' before '{' token

Also a void function does not have a return, so you probably want the function prototype to look something like

double myFunction( . . . );

I believe that this:

}
char letterGrade (double numericGrade) 

{

is the end of the function definition for final_grade() and the start of the defintion for letterGrade(), though the spacing as posted makes it difficult to read.

oh wow yes indeed

might need a prototype

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.