当前位置:   article > 正文

利用线性表编写简单的通讯录程序_用线性表写一个通讯录

用线性表写一个通讯录
#include <stdio.h>
#include <string.h>
#include <stdlib.h>


#define MAX 100
#define TRUE 1
#define FALSE 0
#define Status int


typedef struct node
{
char name[12];
char addr[40];
char mphone[12];
char tel[14];
char sex;
unsigned char age;
}DataType


typedef struct
{
DataType Element[MAX];
int length;
}Slist;




char *menu_1[] = {
"***********************\n",
"1.增加记录\n",
"2.删除记录\n",
"3.修改记录\n",
"4.查询记录\n",
"0.退出\n",
"***********************\n"
};
char *menu_query1[] = {
"***********************\n",
"1.按姓名查询\n",
"2.按手机号码查询\n",
"3.全部输出\n",
"0.退出\n",
"***********************\n"

};

char *menu_query2[] = {
"***********************\n",
"1.按姓名修改\n",
"2.按手机号码修改\n",
"0.退出\n",
"***********************\n"
};

char *menu_delete1[] = {
"***********************\n",
"1.按姓名删除\n",
"2.按手机号码删除\n",
"0.退出\n",
"***********************\n"
};




char menu(char *str[],int len)
{
char sel;
int i;
for (i=0 ; i<len; i++)
{
printf("%s",str[i]);
}
printf("请输入您的选择:");
scanf(" %c",&sel);
    getchar();
return sel;
}


Status InitList(Slist *L)
{
L->length = 0;
return TRUE;
}


int ListLength(Slist L)
{
return L.length;
}


Status ListEmpty(Slist L)
{
if ( 0 == L.length)
{
return TRUE;
}
else
{
return FALSE;
}
}


Status ListInsert(Slist *L,int i,DataType
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/559433
推荐阅读
相关标签
  

闽ICP备14008679号