eeeee

PHOTO EMBED

Tue Apr 27 2021 03:47:30 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class employeefile {
private:
	char employee[20];
	char worktype[20];
	int age;
public:
	void getdata(void)
	{
		cout << "Enter employee name:"; cin >>employee;
		cout << "Enter work type:"; cin >> worktype;
		cout << "Enter age:"; cin >> age;
	}
	void showdata(void)
	{
		cout << "\n employee name:"<<employee<<endl;
		cout << "\n work type:" << worktype << endl;
		cout << "\n age:" << age << endl;
	}

};
int main()
{
	employeefile E;
	E.getdata();
	ofstream creatfile("employee.txt" /*ios::binary*/);
	creatfile.write((char*)&E, sizeof(E));
	creatfile.close();
	ifstream infine("employee.txt" /*ios::binary*/);
	infine.read((char*)&E, sizeof(E));
	E.showdata();
	infine.close();
	return 0;
};
content_copyCOPY