#include"stdio.h"
#include"conio.h"
#include"iostream.h"
#include"iomanip.h"
#include"fstream.h"
#include"process.h"
#include"string.h"
class nhansu
{
private:
char hoten[35];
int tuoi;
char donvi[30];
char que[20];
public:
void nhap();
void xuat();
friend void docfile(char *tentep,nhansu *ns,int &n);
friend void bosung(char *tentep);
friend void sua(char *tentep);
friend void chen(char *tentep);
friend void tim(char *tentep);
friend void xoa(char *tentep);
friend void xuatfile(char *tentep);
friend void ghi(char *tentep,nhansu *ns,int n);
};
void nhansu::nhap()
{
cout<<"
Nhap hoten:"; gets(hoten);
cout<<"
Nhap tuoi:"; cin>>tuoi;
cout<<"
Nhap donvi:"; gets(donvi);
cout<<"
Nhap que:"; gets(que);
};
void nhansu::xuat()
{
cout<<"
"<<setw(10)<<hoten<<setw(6)<<tuoi<<setw(10)<<donvi<<setw(10)<<que;
}
void taofile(char *tentep)
{
FILE *f;
int i,n;
nhansu tg;
f=fopen(tentep,"wb");
cout<<"
Nhap so ban ghirb");
fseek(f,0,2);
d=ftell(f);
n=d/sizeof(nhansu);
fseek(f,0,0);
for(i=1;i<=n;i++)
fread(&ns[n],sizeof(nhansu),1,f);
fclose(f);