#include<bits/stdc++.h>
using namespace std;
class Dog
{
public:
int age;
double weight;
Dog(int a, double b): age(a) , weight(b) {
}
Dog() {
}
} ;
int main()
{
Dog dog1(10, 5);
Dog dog2;
/*ofstream out1("dog.txt", ios::out);
out1 << dog1.age << " " << dog1.weight ;
out1.close();
ifstream in1("dog.txt", ios::in);
in1 >> dog2.age >> dog2.weight;
in1.close();
*/
ofstream out1("dog.dat", ios::out | ios::binary);
out1.write((char*)(&dog1), sizeof(dog1));
out1.close();
ifstream in1("dog.dat", ios::in | ios::binary);
in1.read((char*)(&dog2), sizeof(dog2));
in1.close();
cout << dog2.age << " " << dog2.weight;
}