1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Structures

Discussion in 'C' started by flank, Jun 12, 2012.

  1. flank

    flank New Member

    Joined:
    Jun 12, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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 ; }
     

Share This Page