//The following partial definition is given for a class Pairs: #include #include using namespace std; class Pairs { public: Pairs( ); Pairs(int first); Pairs(int first, int second); //other members and friends friend istream& operator>> (istream& ins, Pairs& second); friend ostream& operator<< (ostream& outs, const Pairs& second); friend Pairs operator+ (const Pairs& first, const Pairs& second); friend Pairs operator- (const Pairs& first, const Pairs& second); friend Pairs operator* (const Pairs& first, const Pairs& second); private: int f; int s; }; Pairs::Pairs ( ) { f = 0; s = 0; } Pairs::Pairs(int first) { f = first; s = 0; } Pairs::Pairs(int first, int second) { f = first; s = second; } ostream& operator<< (ostream& outs, const Pairs& second) { outs << "(" << second.f << "," << second.s << ")"; return outs; } istream& operator>> (istream& ins, Pairs& second) { string inp; ins >> inp; sscanf(inp.c_str(), "(%d,%d)", &second.f, &second.s); return ins; } Pairs operator+ (const Pairs& first, const Pairs& second) { Pairs alie; int a, b; a = first.f + second.f; b = first.s + second.s; alie = Pairs (a, b); return alie; } Pairs operator- (const Pairs& first, const Pairs& second) { Pairs nowai; int a, b; a = first.f - second.f; b = first.s - second.s; nowai = Pairs (a, b); return nowai; } Pairs operator* (const Pairs& first, const Pairs& second) { Pairs wai; int a, b; a = first.f * second.f; b = first.s * second.s; wai = Pairs (a, b); return wai; } int main () { Pairs hax1 = Pairs (5,6); Pairs hax2 = Pairs (5,-4); Pairs hax3 = Pairs (-5,4); Pairs hax4 = Pairs (-5,-6); Pairs imba, orly, owl, nou; orly = hax1 + hax2; owl = hax1 - hax2; nou = hax1 * hax2; cout << hax1 << " || " << hax2 << " || " << hax3 << " || " << hax4 << endl; cout << orly << " || " << owl << " || " << nou << endl; cout << "enter the imba: "; cin >> imba; cout << "the imba -> " << imba << endl; return 0; } /* Question 5 Turn the Pairs class from question 3 in this assignment into an ADT, so that separate files are used for the interface and implementation. Use separate compilation to compile the implementation separate from the application program that tests the ADT. */