Name: _OP_ 2010-05-10 1:41
I'm trying to take the input of a full name in my main, and save it to as first, middle, last parts of the name. I'm am having major problems moving from my Student class to the Name class. Any ideas/help?
[code]
class Student{
public:
Student();
void SetName(istream &, Student &);
private:
Name N;
};
void Student::SetName(istream & in, Student & S){
in.getline(S.N.SetFirst(), 10); //???
}
class Name{
public:
Name()
bool SetFirst(char *);
private:
char * First;
char * Middle;
char * Last;
};
bool Name::SetFirst(char * F){
First = F;
return true;
}
void main(){
cout << "Enter Student's name(First Middle Last): ";
cin >> ???
}
[code]
class Student{
public:
Student();
void SetName(istream &, Student &);
private:
Name N;
};
void Student::SetName(istream & in, Student & S){
in.getline(S.N.SetFirst(), 10); //???
}
class Name{
public:
Name()
bool SetFirst(char *);
private:
char * First;
char * Middle;
char * Last;
};
bool Name::SetFirst(char * F){
First = F;
return true;
}
void main(){
cout << "Enter Student's name(First Middle Last): ";
cin >> ???
}