Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- class Raum
- {
- int x,y,z;
- public:
- Raum(int x,int y,int z)
- {
- this->x = x;
- this->y = y;
- this->z = z;
- }
- Raum()
- {
- x = 0;
- y = 0;
- z = 0;
- }
- void setter(int x,int y,int z)
- {
- this->x = x;
- this->y = y;
- this->z = z;
- }
- int dif_x(Raum &r)
- {
- int erg;
- erg = x-r.x;
- return erg;
- }
- int dif_y(Raum &r)
- {
- int erg;
- erg = y-r.y;
- return erg;
- }
- int dif_z(Raum &r)
- {
- int erg;
- erg = z-r.z;
- return erg;
- }
- int get_x()
- {
- return x;
- }
- Raum operator+(Raum &r)
- {
- Raum erg;
- erg.x = x+r.x;
- erg.y = y+r.y;
- erg.z = z+r.z;
- return erg;
- }
- };
- int main()
- {
- int x,y,z;
- Raum zahl1,zahl2;
- cin>>x>>y>>z;
- zahl1.setter(x,y,z);
- cin>>x>>y>>z;
- zahl2.setter(x,y,z);
- x = zahl1.dif_x(zahl2);
- y = zahl1.dif_y(zahl2);
- z = zahl1.dif_z(zahl2);
- string name;
- cin>>name;
- ofstream datei(name);
- if(datei == NULL)
- {
- cout<<"ERROR";
- }
- else
- {
- datei<<x<<endl<<y<<endl<<z<<endl;
- datei.close();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement