Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
operator++
//g++ 5.4.0 #include <iostream> using namespace std; class complex { int r,i;//real,imaginary public: complex(int a,int b) //constructor for getting values { r=a; i=b; } complex() {} void display() { cout<<"no is "<<r <<" + "<<i<<" i \n"; } friend complex operator++(complex &a); friend complex operator++(complex &a,int ); }; complex operator++(complex &a)//for ++n1 { a.r=a.r+1; a.i=a.i+1; return a; } complex operator++(complex &a,int )//for n1++ { a.r=a.r+1; a.i=a.i+1; return a; } int main() { cout << "Hello, world!\n"; complex n1(1,1); n1.display(); ++n1; n1.display(); n1++; n1.display(); }
run
|
edit
|
history
|
help
0
Kth smallest element
test
cppOverride
string iteration performance
Splitwise Problem - 1
mine
TempSpecial
Inventory
Minimum Vertices to Traverse Directed Graph
PhoneDirectory