00:27 Reload example | |
#include <iostream> using namespace std; class Int{ int i; public: Int(int a){i=a;} friend int operator + (Int&, Int&); friend int operator * (Int&, Int&); friend int operator % (Int&, Int&); }; int operator + (Int& a, Int& b){return a.i*b.i-a.i;}; int operator * (Int& a, Int& b){return a.i-b.i;}; int operator % (Int& a, Int& b){return (100*b.i)/a.i;}; int main() { int x,y; cin>>x>>y; Int a(x),b(y); cout<<endl<<a*b+(a+b)<<endl<<a%b; return 0; } | |
|
Total comments: 0 | |