C语言成学设计

来源:百度知道 编辑:UC知道 时间:2024/06/03 19:41:22
题目:通讯录管理系统
要求:
1.主要功能:
(1)能建立、修改和增删学生通讯录
(2)能够按多种方式进行查询
2.要求:界面友好,易于操作

#include <stdio.h>
#include <malloc.h> //得到指向大小为Size的内存区域的首字节的指针//
#include <string.h>
#include <stdlib.h> //标准库函数//
#define NULL 0
#define LEN sizeof(struct txlproject) //计算字节//
int n;
struct txlproject
{
char name[100];
char work[100];
char handset[100];
char email[100];
char address[100];
struct txlproject *next;
};
struct txlproject *shifang(struct txlproject *head); // 释放内存函数声明
/////////////// 创建函数 /////////////////////////
struct txlproject *creat(void)
{
struct txlproject *head,*p1,*p2;
char name[100];
n=0;
p1=(struct txlproject *)malloc(LEN);
p2=p1; //强制内存转换//
printf("请输入通讯录的内容!\n姓名输入为0时表示创建完毕!\n");
printf("请输入姓名:"); gets(name);
if(strcmp(name,"0")!=0)
{
strcpy(p1->name,name);
printf("请输入职业:");