0

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 ! :)

2
Contributors
1
Reply
27
Views
2 Years
Discussion Span
Last Post by NathanOliver
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.