void CalcGPA(Subject& Sub);
structure subject {// subject information
charSubName[30]; // Subject Name
int Hakjum; // Subject credit
Char Grade[10]; // Subject Grade
float GPA; // subject rating
};
structure Student {// Student Information
charStdName[30]; // Student Name
int Hakbun; // Class number
Subject Sub[3]; // Subject
float AveGPA; // Subject Average Rating
};
int main(){
Subject subject[6];
Student student[2];
for (int i = 0; i < 3; i++)
{
cout << "Lecture name:";
cin >> subject[i].SubName;
cout << "Subject credit score :");
cin >> subject[i].Hakjum;
cout << "Subject grade<A+~F>: ";
cin >> subject[i].Grade;
cout << "\n";
CalcGPA(subject[i].Grade);
}
}
subject[i] within this code.An error occurs when I try to refer to the grade using the structural reference. What should I do? You have entered only the code for the part you think is necessary for the question.
void CalcGPA(Subject& Sub);
Looking at the declaration part of the function, it is referenced by the subject structure CalcGPA(subject[i].Grade);
is inserting a character array.
© 2024 OneMinuteCode. All rights reserved.