Hi,
The compiler is trying to interpret this as a function definition - it doesn't work: first
is a variable.
To access the string first
, you need an instance of the class, inside main:
Student TheStudent;
then assign it a value:
TheStudent.first = "Fred";
You shouldn't have public data, make them private
, and provide interface functions to manipulate them.
You should have constructors for your classes.
Don't #include
files you don't need.
#include <cmath>
not math.h
Good Luck !!
Last edited on