Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Pont{
- private:
- int x,y;
- public:
- Pont(){};
- Pont(int nX, int nY): y(nY),x(nX){};
- void kiir(){
- cout << "x: " << this->x << " y:" << this->y<<"\n";
- cout << "\n";
- }
- };
- int main()
- {
- Pont p1(2,3);
- Pont p2(2,3);
- Pont p3(2,3);
- p1.kiir();
- Pont pontok[3];
- pontok[0] =Pont(12,13);
- pontok[1] =Pont(14,15);
- pontok[2] =Pont(16,16);
- for(int i= 0; i<3; i++){
- pontok[i].kiir();
- }
- Pont* ppontok[3];
- ppontok[0] = new Pont(12,13);
- ppontok[1] = new Pont(14,15);
- ppontok[2] = new Pont(16,16);
- for(int i= 0; i<3; i++){
- ppontok[i]->kiir();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement