Hey guys im new to C++ so if this is an dumb question all apologies. Whats going on is i am comparing a user entered major with one from a structure of information on students (name,hours,gpa,etc..). for this im trying to pull out majors in example say someone was a ENG major then it would pull out those students and print some of there cudentials.
Anyways im getting an error of
" cannot convert StudentRecord' to `const char*' for argument `2' to `int strcmp(const char*, const char*)' "
for these two lines
if(strcmp( student.major, studentmajorIn)!=0)
if(strcmp( student.major, studentmajorIn)==0)
any help is very appreciated.
void option5(StudentRecord student[],int n)
{
double grade;
char majorIn[5];
int i;
cout<<"Enter desired major"<<endl;
cin.getline(majorIn,5);
cout<<"enter desired GPA"<<endl;
cin>>grade;
cout<<"Last Name "<<"First Name "<<"Hometown "<<"GPA"<<endl<<endl;
if(strcmp( student[i].major,student[i]majorIn)!=0)
cout<<"No Matches found"<<endl;
for(i=0;i<=n-1;i++)
{
if(strcmp( student[i].major, student[i]majorIn)==0)
if(student[i].gpa>=grade)
cout<<left<<setw(16)<<student[i].lastName<<setw(16)<<student[i].firstName<<setw(16)<<student[i].hometown<<setw(4)<<right<<student[i].gpa<<endl;