Created
April 23, 2017 16:37
-
-
Save patelmilanun/196d50d3a9673eecff994270df65136a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class coordinate | |
{ | |
private: | |
int x,y,z; | |
public: | |
void set() | |
{ | |
cout<<"Enter x:"<<endl; | |
cin>>x; | |
cout<<"Enter y:"<<endl; | |
cin>>y; | |
cout<<"Enter z:"<<endl; | |
cin>>z; | |
} | |
void print() | |
{ | |
cout<<"x:"<<x<<endl; | |
cout<<"y:"<<y<<endl; | |
cout<<"z:"<<z<<endl; | |
} | |
void operator ++ (int) | |
{ | |
x++; | |
y++; | |
z++; | |
} | |
}; | |
int main() { | |
// your code goes here | |
coordinate c; | |
c.set(); | |
c++; | |
c.print(); | |
return 0; | |
} | |
=========================output============================ | |
Enter x:1 | |
Enter y:2 | |
Enter z:3 | |
x:2 | |
y:3 | |
z:4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment