请问下面的错误 输出内存不能读取 不知道哪个指针有问题
#include<iostream>
#include<fstream>
ofstream oFile;
oFile.open("c:\\salary.dat",ios::out);
char id[8];
char name[20];
double salary;
double fee;
double bonus;
double delsalary;
double realsalary;
oFile<<"职工编号"<<"\t姓名"<<"\t基本工资"<<"\t奖金"<<"\t扣除"<<endl;
for(int i=0;i<3;i++){
cout<<"请输入员工编号: "; cin>>id;
cout<<"请输入姓名: "; cin>>name;
cout<<"请输入基本工资: "; cin>>salary;
cout<<"请输入加班工资: "; cin>>fee;
cout<<"请输入奖金: "; cin>>bonus;
cout<<"请输入扣除: " ; cin>>delsalary;
oFile<<id<<" "<<name<<" "<<salary<<" "<<fee<<" "<<bonus<<" "<<delsalary<<endl;
}
oFile.close();
/*读取文件*/
ifstream iFile;
iFile.open("c:\\salary.dat",ios::in);
cout<<"职工编号"<<"\t姓名"<<"\t基本工资"<<"\t奖金"<<"\t扣除"<<"\t实发工资"<<endl;
while(!iFile.eof()){
iFile>>id>>" ">>name>>" ">>salary>>" ">>fee>>" ">>bonus>>" ">>delsalary;
realsalary=salary+bonus+fee-delsalary;//计算实发工资
cout<<id<<"\t"<<name<<"\t"<<salary<<"\t"<<fee<<"\t"<<bonus<<"\t"<<delsalary<<"\t"<<realsalary<<endl;
}
iFile.close();
}
在输入的时候没有问题 读取文件时候就输出一个 cout输出的文件 下面读取不了