// Oldham, Jeffrey D. // 2000 Jan 28 // CS1321 // Modified by: // Massingill, Berna L. // 2001 Jan #include #include // has EXIT_SUCCESS #include // has pair<...>() #include // has string int main() { // "std::" prefix is not needed for g++ but may be needed by other // compilers. std::pair o; // Creates an empty pair (to hold a // string and an int). std::pair p("bye", 18); // Creates a string-int pair. std::pair r = make_pair(string("aloha"), 19); // Creates another string-int pair. cout << "The pair p contains " << p.first << " and " << p.second << ".\n"; cout << "The pair r contains " << r.first << " and " << r.second << ".\n"; cout << "Are p and r are equal (same contents)? "; if (p == r) cout << "yes\n"; else cout << "no\n"; cout << "Copy r's contents to p and then check if r not equal to p: "; p = r; if (r != p) cout << "not equal\n"; else cout << "equal\n"; return EXIT_SUCCESS; }