C语言高手进: 谁能帮我编一个电子电话本的程序啊!急! 只要有添加和删除功能和查找功能就可以了!谢谢啊

来源:百度知道 编辑:UC知道 时间:2024/06/09 19:02:04
Load()
inqiury()
delete()
show_list()
需要用TC英文系统完成,直接在TC中显示如
**********************
1.load_record
2.search_record
3.list_record
4.delete_record
Enter your choice: 3
*****************
name:zhangsan
address:shanghai
phone:123456

name:lisi
address:shanghai
phone:124562345
这样就可以了。需要用到switch()文件等函数

能否说的具体一点,比如添加和删除的规则是什么,姓名显示中文还是英文,最好把子函数的参数也写一下。

更新版本。加入地址功能,查询功能更正为按姓名模糊查询(以前是精确查询)。tc环境中调试通过。至于菜单的形式和输出格式请自行控制调整,还有什么问题继续发消息问吧。。
#include <stdio.h>
#include <string.h>
struct telbook
{
int KeySeq;
char name[20];
char telnumber[20];
char address[40];
struct telbook *next;
};
char datapath[500];
void save(struct telbook *head)
{
struct telbook *p;
FILE *fp;
p=head->next;
fp=fopen(datapath,"w");
while (p!=NULL)
{
fwrite(p,sizeof(struct telbook)-sizeof(struct telbook *),1,fp);
p=p->next;
}
fclose (fp);
}
void load(struct telbook *head)
{
FILE *fp;
struct telbook *p,*q;
char temp[2];
printf ("Please enter datafile path and datafile name.\n");
gets(temp);
gets(datapath);
fp=fopen(datapath,"r");
if (!fp)