Hey there I am getting an unusual error message I don't quite understand. I was wondering if I could have some help. The error is " error C3861: 'Tests_weight': identifier not found" I hope you guys can follow the code and any helpful input would be greatly appreciated!
Thanks in advance!
regards,
dalymiddleboro
#include <iostream>
#include <string>
using namespace std;
struct T_worth{ // Structure to create a record of a tests name,score,and weight in final grade;
string name;
float weight;
float score;
}T_value[250]; // array for the structure.
int OptionMenu(int); // menu
void GradeAve(float GA_number, float G_ave,float GA_sum, int GA_count); // case 1 proto
void Tests_Weight(T_worth test, int T_count); // case 2
int main()
{ float GA_sum=0; // sum for case 1
float GA_ave=0; // average for case 1
int menunumber=0; // menu selection
int GA_count=0;
float GA_number=0;
int menu_number_returned=0; // menu value returned for switch statement.
int T_count = 0;
menu_number_returned= OptionMenu(menunumber); // call function to menu select and return value to menu_number_returned
system("cls"); // clear screen
switch(menu_number_returned) // Switch statement to process the menu selection screen
{
case 1:
GradeAve(GA_number,GA_sum,GA_ave,GA_count); // menu selection 1 call; find average of a test score
break;
case 2:
Tests_weight(T_count,T_value[250]); // menu selection 2 call; still working on this...
break;
// case 3:
// break;
//case 4:
//break;
//case 5:
//break;
default:
cout<<"Exiting The Program"<<endl;
exit;
}
system("pause");
return 0;
}
int OptionMenu(int menunumber)
{
cout<<"Choose an option, or hit any other key to EXIT:\n-----------------------------------------------\n\n1.) Compute grade average.\n\n2.) Calculate a specific tests weight in your final grade.\n\n3.) Store a test grade.\n\n4.) Store a homework grade.\n\n5.) Store a lab assignment grade."<<endl;
cin>> menunumber;
return menunumber;
}
void GradeAve(float GA_number, float G_ave,float GA_sum, int GA_count)
{
cout<<"How many grades would you like to process?"<<endl;
cin>>GA_count;
system("cls");
for(int i = 0;i<GA_count;i++)
{
cout<<"Enter a grade:"<<endl;
cin>>GA_number;
GA_sum += GA_number;
system("cls");
}
G_ave = GA_sum/GA_count;
cout<<"The Sum of the grades entered is: "<<GA_sum<<endl;
cout<<"The Average is: "<<G_ave<<endl;
return;
}
void Tests_Weight(T_worth test, int T_count)
{
cout<<"How many tests are you planning on storing?:"<<endl;
cin>>T_count;
for (int index=0;index<T_count;index++)
{
cout<<"What is the name of the test?:"<<endl;
cin>>T_value[index].name;
cout<<"What is the score of the test?:"<<endl;
cin>>T_value[index].weight;
}
return;
}