Hello Guys,
I have a bit of confusion about how to define a searching function.Here is what I wanted to do, I need to define the searching function which takes the name of a student as (stated in the argument) and returns a pointer to that or NULL if the name is found.
Student *students = NULL;//Defined as a global varibale and intiated as NULL
and defined the class like below.
class Student
{
private:
string Name;
string ID;
string *next;
public:
Student(string, string, Student *)
{
string Name;
string ID(" ");
Student *next(NULL);
}
string get_name()
{
return Name;
}
string get_next()
{
return ID;
}
friend ostream& operator<<(ostream &out, Student &st)
{
out << st.Name << ", ID number: " << st.ID;
return out;
}
};
// Global function to search a student
Student *searchstudent(string Name)
{
//TO DO
}
Thanks a lot ! :)