Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Structures (http://www.go4expert.com/forums/structures-t28575/)

flank 13Jun2012 03:45

Structures
 
Can someone explain the following code. I need to include a structure in my program that would add a way to represent the worker's name as first name, last name, and "other" names (which could be a middle initial or several names)and salutaion (e.g. Mr. or Ms.)so that the name can be displayed or written to a file. I was given the following code as a guide but do not understand it.

struct FullName {
FullName( string salutaion,
string first,
string last,
string other )
: salutaion(salutaion),
last(last),
first(first),
other(other)
{}

string salutaion,
first,
last,
other;
};
ostream& operator<<( ostream& os, const FullName& n )
{ return os << n.salutaion << n.first << n.last << n.other ; }


All times are GMT +5.5. The time now is 09:33.