64,647
社区成员
发帖
与我相关
我的任务
分享
#ifndef PERSONAL
#define PERSONAL
#include <fstream.h>
#include<string.h>
class Personal
{
public:
Personal();
Personal(char*,char*,char*,int,long);
void writeToFile(fstream&) const;
void readFromFile(fstream&);
void readKey();
int size() const
{
return 9+nameLen+cityLen+sizeof(year)+sizeof(salary);
}
bool operator==(const Personal& pr) const
{
return strcmp(pr.SSN,SSN)==0;
}
protected:
const int nameLen,cityLen;
char SSN[10],*name,*city;
int year;
long salary;
ostream& writeLegibly(ostream&);
friend ostream& operator<<(ostream& out,Personal& pr)
{
return pr.writeLegibly(out);
}
istream& readFromConsole(istream&);
friend istream& operator>>(istream& in,Personal& pr)
{
return pr.readFromConsole(in);
}
};
#endif
#include <fstream>
#include<cstring>
#include<string>
using namespace std;
#include <fstream>
#include<cstring>
#include<string>
using namespace std;
//#include <fstream.h>
#include<string.h>
#include <iostream>
using namespace std;
#include <fstream.h>
//改成下面试试
#include <fstream>
using namespace std;