C++ 修改错误

来源:百度知道 编辑:UC知道 时间:2024/06/18 10:03:31
#include <iostream.h>
#include <ifstream>
#include <ofstream>
#include <string.h>
class Customer
{
private:
char name[40];
int age;
char telNo[20];
float totalFee;
public:
Customer( );
void setName(char *name);
char *getName( );
void setAge(int age);
int getAge( );
void setTelNo(char *telNo);
char *getTelNo( );
void setTotalFee(float totalFee);
float getTotalFee( );
};
Customer::Customer( )
{
strcpy(this->name, "");
}
void Customer::setName(char *name)
{
strcpy(this->name, name);
}
char * Customer::getName( )
{
return name;
}
void Customer::setAge(int age)
{
this->age=age;
}
int Customer::getAge( )
{
return age;
}

void Customer::setTelNo(char *telNo)
{
strcpy(this->telNo, telNo);
}
char * Customer::get

#include <ifstream>
#include <ofstream>
改成
#include <fstream.h>

#include <ifstream>
#include <ofstream>
这两句有没有打错库名?
是不是应该为
"ifstream.h"
"ofstream.h"

#include <fstream>

没有什么ifstream和 ofstream的

改成这样就好了
#include<fstreasm>
fstream fs
fs.read(&cs, sizeof(cs));
fs.write(&cs, sizeof(cs));