In a data-structure, how do you insert a function?
struct Student_info {
std::string name;
double midterm, final;
unsigned int& counter;
std::vector<double> homework;
double overall = grade(students[counter]);
};
always get this type of error:-
a. "variable" was not declared in this code.
b. "Student_info::counter" cannot appear in a constant-expression.
c. an array reference cannot appear in a constant-expression.
d. a function call cannot appear in a constant-expression
edit:- oopps, i mean student_info contain in a vector, wait, why that's info needed anyway... Dx
oh, and btw, this is from Accelerated C++, a book obviously, and I'm trying to answer one of its exercise, then I need to know this part, not found any on the book Dx
the question is 4-6. Rewrite the Student_info structure to calculate the grades immediately and store only the final grade.