头文件:
#ifndef _ADRESS_H
#define _ADRESS_H
#define SUCCESS 10000
#define FAILURE 10001
#define TURE 10003
#define FALSE 10004
struct adress
{
char name[20];
int num;
struct adress *next;
};
typedef struct adress Sad;
typedef int ElemType;
int LinkInit(Sad **l);
void welcome ();
void menu();
int add(Sad *l);
int addressTraver(Sad *l, void (*p)(ElemType),void (*pp)(char *));
int LocatElem(Sad *l);
int change ( Sad *l,int (*p)(char*,char*));
int delete (Sad *l);
int rever(Sad *l);
int clear(Sad *l);
int destory(Sad **l);
#endif
函数文件(加上了printf,要不太麻烦)
#include "adress.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void menu()// 主界面
{
printf("*************welcome to use********\n");
printf("**1 功能简介 2 添加信息**\n");
printf("**3 查看信息 4 查找信息**\n");
printf("**5 修改信息 6 删除信息**\n");
printf("**7 反转信息 8 清空信息**\n");
printf("**9 毁坏信息 10 退出 **\n");
printf("*************************************\n");
}
function()
{
printf("!!!!!!!!想多了!!!!!!! \n");
}
void welcome()//欢迎
{
system("clear");
printf("\n\n\n\n\n\n\n\n\n\n\n************************************************\n");
printf("********************WELCOME*********************\n");
printf("***************老式山寨诺基亚版*****************\n");
sleep(2);
}
int LinkInit(Sad **l)// 初始化
{
*l = (Sad *)malloc(sizeof(Sad)*1);
if(NULL == *l)
{
return