中级编程题

来源:百度知道 编辑:UC知道 时间:2024/05/31 15:24:32
编一个通讯录的程序,通讯录包含4项内容;姓名(英文),地址,电话,e-mail 。
要求能完成的功能:
1.通讯录创建(就是输入通讯录的4项内容)
2.查询
3数据删除
附;程序中含有子函数,结构,指针等。请高手指教
请把调试成功的程序放上

#include <iostreame.h>
#include <stdlib.h>
#include <string.h>
struct node
{char Name[15],Addr[20],Tele[14],E-mail[20];
struct node *next;
};
//////////////////////////////////文件操作:
vode file_write(const node *pc) //保存结点
{char filename[20];
ofstream ofile;
count<<"请输入文件名(包括路径)\n";
cin>>filename;
ofile.open(filename,ios::app|ios::binary);
if(!ofile)
{cout<<"你输入的文件名有误!\n";
exit(0);
}
ofile.write(pc->Name,15);
ofile.write(pc->Addr,20);
ofile.write(pc->Tele,14);
ofile.write(pc->E-mail,20);

}
node *file_read(const char *filename)
{node * head,*pn,*pt;
char name[15],addr[20],tele[14],e-mail[20];
head=0;
ifstream ifile;
ifile.open(filename,ios::in|ios::binary);
if(!ifile)
{c