home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / CH09 / F091922.FLD < prev    next >
Encoding:
Text File  |  1993-10-06  |  2.0 KB  |  1 lines

  1. ╘// Example of overloading the [] operator                                                        //   Part 2 of 2                                                                                   ostream╦&                                                                                       operator<<( ostream╦& os╦, LongPair x╦);╘  // use to print a LongPair                    ostream╦&                             ╘  // use to print a GradeAssoc                          ╦operator<<( ostream╦& os╦, Grade╦::GradeAssoc assoc╦);                               ╘// Define and initialize to associative array                                                    Grade╦::GradeAssoc╦;                                                                         Grade╦::GradeList╦[] = { {"A"╦, {80╦, 100╦}}, {"B"╦, {70╦, 79╦}},                ╦{"C"╦, {60╦, 69╦}}, {"D"╦, {50╦, 59╦}}, {"F"╦, {0╦, 49╦}} };    ╦void main╦() {                                                                                   Grade x╦;╘         // Create a grade object                                                    cout ╦<< x╦["A+"╦];╘ // get the range of the letter grade                                cout ╦<< x╦[90╦];  ╘ // get the letter grade                                          ╦};