kjvba
来源:互联网 发布:mac怎么使用百度云 编辑:程序博客网 时间:2024/06/04 23:32
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "addresslist.h"
#include <stdlib.h>
#include <unistd.h>
#include "addresslist.h"
int tration(char *p)
{
if(strcmp("ID",p) == 0)
{
return 1;
}
if(strcmp("name",p) == 0)
{
return 2;
}
if(strcmp("phone",p) == 0)
{
return 3;
}
if(strcmp("address",p) == 0)
{
return 4;
}
if(strcmp("companynumber",p) == 0)
{
return 5;
}
}
{
if(strcmp("ID",p) == 0)
{
return 1;
}
if(strcmp("name",p) == 0)
{
return 2;
}
if(strcmp("phone",p) == 0)
{
return 3;
}
if(strcmp("address",p) == 0)
{
return 4;
}
if(strcmp("companynumber",p) == 0)
{
return 5;
}
}
int main()
{
int ret;
char choice;
memberlist member1;
member p;
member a[10];
{
int ret;
char choice;
memberlist member1;
member p;
member a[10];
p.name = (char *)malloc(sizeof(char) * 10);
p.homenum = (char *)malloc(sizeof(char) * 50);
p.address = (char *)malloc(sizeof(char) * 50);
p.companynum = (char *)malloc(sizeof(char) * 50);
p.id = (char *)malloc(sizeof(char) * 50);
p.homenum = (char *)malloc(sizeof(char) * 50);
p.address = (char *)malloc(sizeof(char) * 50);
p.companynum = (char *)malloc(sizeof(char) * 50);
p.id = (char *)malloc(sizeof(char) * 50);
Initlist(&member1);
while(1)
{
system("clear");
headdisplay();
printf("please input your choice :\n");
scanf(" %c",&choice);
system("clear");
while(1)
{
system("clear");
headdisplay();
printf("please input your choice :\n");
scanf(" %c",&choice);
system("clear");
switch(choice)
{
case('A'):{
input(&p,member1);
Listtail(&member1,p);
printf("input success!\n");
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('B'):{
Listtraverse(member1,a);
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('C'):{
char *a = (char *)malloc(sizeof(char) * 50);
printf("please input you need's member:\n");
scanf("%s",a);
ret = Listsearch(member1,a);
if(ERROR == ret)
{
printf("Don't search %s!\n",a);
}
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('D'):{
char *b = (char *)malloc(sizeof(char) * 50);
printf("please input you need's delete member:\n");
scanf("%s",b);
ret = Listdelete(member1,b);
if(ERROR == ret)
{
printf("system can't find the name! #_#\n\n\n");
}
else
{
printf("delete success!\n\n\n");
}
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('E'):{
char *c = (char *)malloc(sizeof(char) * 50);
char *d = (char *)malloc(sizeof(char) * 50);
printf("please input you need's member:\n");
scanf("%s",c);
ret = Listsearch(member1,c);
if(ERROR == ret)
{
printf("Don't search %s!\n",a);
printf("please press 1 exit ^_^\n");
exit1();
break;
}
printf("Now,please input what you want to mend :^_^\n");
scanf("%s",d);
switch(tration(d))
{
case (1):{
char *id = (char *)malloc(sizeof(char) * 50);
printf("The new ID is :");
scanf("%s",id);
Mendlist1(&member1,c,id);
free(id);
break;
}
case (2):{
char *name = (char *)malloc(sizeof(char) * 50);
printf("The new name is :");
scanf("%s",name);
Mendlist2(&member1,c,name);
free(name);
break;
}
case (3):{
char *phone = (char *)malloc(sizeof(char) * 50);
printf("The new phone is :");
scanf("%s",phone);
Mendlist3(&member1,c,phone);
free(phone);
break;
}
case (4):{
char *address = (char *)malloc(sizeof(char) * 50);
printf("The new address is :");
scanf("%s",address);
Mendlist4(&member1,c,address);
free(address);
break;
}
case (5):{
char *companynum = (char *)malloc(sizeof(char) * 50);
printf("The new company number is :");
scanf("%s",companynum);
Mendlist5(&member1,c,companynum);
free(companynum);
break;
}
}
{
case('A'):{
input(&p,member1);
Listtail(&member1,p);
printf("input success!\n");
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('B'):{
Listtraverse(member1,a);
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('C'):{
char *a = (char *)malloc(sizeof(char) * 50);
printf("please input you need's member:\n");
scanf("%s",a);
ret = Listsearch(member1,a);
if(ERROR == ret)
{
printf("Don't search %s!\n",a);
}
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('D'):{
char *b = (char *)malloc(sizeof(char) * 50);
printf("please input you need's delete member:\n");
scanf("%s",b);
ret = Listdelete(member1,b);
if(ERROR == ret)
{
printf("system can't find the name! #_#\n\n\n");
}
else
{
printf("delete success!\n\n\n");
}
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('E'):{
char *c = (char *)malloc(sizeof(char) * 50);
char *d = (char *)malloc(sizeof(char) * 50);
printf("please input you need's member:\n");
scanf("%s",c);
ret = Listsearch(member1,c);
if(ERROR == ret)
{
printf("Don't search %s!\n",a);
printf("please press 1 exit ^_^\n");
exit1();
break;
}
printf("Now,please input what you want to mend :^_^\n");
scanf("%s",d);
switch(tration(d))
{
case (1):{
char *id = (char *)malloc(sizeof(char) * 50);
printf("The new ID is :");
scanf("%s",id);
Mendlist1(&member1,c,id);
free(id);
break;
}
case (2):{
char *name = (char *)malloc(sizeof(char) * 50);
printf("The new name is :");
scanf("%s",name);
Mendlist2(&member1,c,name);
free(name);
break;
}
case (3):{
char *phone = (char *)malloc(sizeof(char) * 50);
printf("The new phone is :");
scanf("%s",phone);
Mendlist3(&member1,c,phone);
free(phone);
break;
}
case (4):{
char *address = (char *)malloc(sizeof(char) * 50);
printf("The new address is :");
scanf("%s",address);
Mendlist4(&member1,c,address);
free(address);
break;
}
case (5):{
char *companynum = (char *)malloc(sizeof(char) * 50);
printf("The new company number is :");
scanf("%s",companynum);
Mendlist5(&member1,c,companynum);
free(companynum);
break;
}
}
printf("mend success!\n");
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('F'):{
exit(0);
break;
}
}
}
return 0;
}
printf("please press 1 exit ^_^\n");
exit1();
break;
}
case('F'):{
exit(0);
break;
}
}
}
return 0;
}
阅读全文
0 0
- kjvba
- 如何在bat文件中设置JAVA临时环境变量
- Android跳转到应用宝指定关键字搜索界面
- 数组逆序
- ROS下的CMakeList.txt编写
- ggplot2 specific command
- kjvba
- 使用redux-thunk实现异步操作的中止
- ASP.NET开发实例大全提高篇-1、目录
- Android-基于无人机-禁飞区/限飞区【地图】的开发
- 生信宝典,生物信息学习资源
- Codeforces 296D Greg And Graph (逆向处理)Floyd
- Oracle创建表空间bug1
- Python中raw字符串与多行字符串
- 【唯快不破】学习开发springboot怎么能不先配置热部署?