0

this is some of my code, could you work out how i am suppose to do this?

/*from main.cpp*/

student.read(cin);
student.print(cout) << endl;
-----------------------------

/*from student.cpp*/
const char * Student::getStudents() const{
        string tmp;
        tmp = getStudentName();
        tmp += ": ";
        tmp += getStudentID();

        return (const char *) tmp.c_str();
}

ostream& Student::print(ostream& stream = cout) const {
        stream << getStudents() << endl;
        return stream;
}

istream& Student::read(istream& stream) const {

        /*What goes here? any help?*/

        return stream;
}

---------------------------------------------------

im not sure how to write the read function. Could anyone give me a hand?
I would like the read function to read in the student's details (the Student's Name, and ID) and then call the function getStudents();

thanks

Edited by Dani: Fixed formatting

2
Contributors
1
Reply
2
Views
13 Years
Discussion Span
Last Post by basementcoder
0

Student::print(ostream& stream = cout) const {

USE CODE TAGS!!! 1. It's easier to read, and 2. You don't get stupid smilies poping up in your code.

Though, sorry, I would help but I only do C++.

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.