c中二进制文件读取问题
各位帮忙看一下,有什么建议提提。让我头疼好久了。第四个不会写,哪位帮我补充一下。。。#include <fstream>
#include <string>
using namespace std;
void input(void)
void clear(void)
void main()
{ struct phone
{string mane;
int num;
}man[50];
phone *p[50];
int i,j,k,s,t;
for (i=0;i<=49;i++)
p[i]=&man[i];
while(true)
{cout<<"请输入要进行的操作"<<endl;
cout<<"1.输入电话记录"<<endl;
cout<<"2.删除电话记录"<<endl;
cout<<"3.查询电话记录"<<endl;
cout<<"4.保存电话记录"<<endl;
cout<<"5.读取电话记录"<<endl;
cout<<"6.退出"<<endl;
}
cin >>i;
switch(i)
{case(1):{for(j=0;j<=49;j++)
{if (p[j]->name=NULL& p[j]->nun=NULL)input(j);
}
break;
}
case(2):cout<<"请输入你要删除的编号:">>endl;
cin>>k;
if(p[k]->name=NULL& p[k]->nun=NULL)
for(s=k;s<=50;s++)
p[k]=p[k+1];
case(3):{ofstream outfile("file1.dat",ios::app|ios::binary);
outfile.close()
}
case(4):
case(5):{struct phone people[50]
ifstream infile("file1.dat",ios::init|ios::binary);
for(t=0;t<50;t++)
infile.read(char*)&(people[t],sizeof(people[t]));
infile.close();
for(t=0;t<50;t++)
cout<<people[t];
}
case(6):abort();
}
}
void input(j)
{cin>>p[j]->name;
cin>>p[j]->num;
break;
}