//加盟会员管理系统
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Member
{
char num[100];//会员编号牌
char name[15];//姓名
char title[20];//会长,副会长,高级会员,普通会员
char sex[20];//性别
char age[20];//年龄
char telephone[20];//电话
struct Member *next;
};
typedef struct Member Node;
typedef struct Member *Link;
void Menu();//主函数及主界面
void Insert(Link head);//插入功能
void Delete(Link head);//删除功能
void Modify(Link head);//修改功能
void Query(Link head);//查询功能
void Save(Link head);//保存功能
void Load(Link head);//载入功能
void main ()//主函数
{
Node head;
void Menu(Link head);
}
void Menu(Link head)//菜单
{
int choice;
do{
printf("1:Insert\n2:Delete\n3:Modify\n4:Query\n5:Save6\n:Load\n0:Exit\n");
scanf("%d", &choice);
switch(choice)
{
case 1:Insert(Link head);break;
case 2:Delete(Link head);break;
case 3:Modify(Link head);break;
case 4:Query(Link head);break;
case 5:Save(Link head);break;
case 6:Load(Link head);break;
case 0:break;
}
}while(choice!=0);
}
void Insert(Link head)//插入
{
Node z;
int choice=1;
if(choice==1)
{
scanf("%s,%s,%s,%s,%s,%s",&z->num,&z->name,&z->title,&z->sex,&z->age,&z->telephone);
z->next=head->next;
head->next=*z;
printf("1:Go on 0:Return menu\n");
scanf("%d",&choice);
}
if(choice==0)
{
void Menu(Link head);
}
}
void Delete(Link head)//删除
{
char num[100];
int judge=1;
int choice=1
Node p1=head->next;
Node p2=head;
if(choice=1)
{
printf("Please Enter Num\n");
scanf("%s",&num);
while(p != NULL)
{
p1=p1->next;
p2=p2->next;
if(num==p1->num)
{
if(p1->next != NULl)
{
p2->next=p1->nxet;
free(p1);
printf("Successfully delete\n");
}
if(p1->next==NULL)
{
p2->next=NULL;
printf("Successfully delete\n");
}
judge=0;
}
}
if(judge=1)
printf("No information found\nFail to delete\n");
printf("1:Go on 0:Return menu\n");
scanf("%d",&choice);
}
if(choice=0)
void Menu(Link head);
}
void Modify(Link head)//修改
{
char num[100],name[15],title[20],sex[20],age[20],telephone[20];
int choice=1;
int date;
if(choice=1)
{
printf("Please enter the modified number\n");
scanf("%s",num);
while(p != NULL)
{
p=p->next;
if(num==p->num)
{
printf("%s,%s,%s,%s,%s,%s\n",p->num,p->name,p->title,p->sex,p->age,p->telephone);
judge=0;
printf("Please enter the modified data\n");
printf("1:num 2:name 3:tetle 4:sex 5:age 6:telephone 0:cancel the change\n");
scanf("%d",&date);
printf("Please information\n");
switch(date)
{
case 1:scanf("%s",&num);p->num=num;break;
case 2:scanf("%s",&name);p->name=name;break;
case 3:scanf("%s",&title);p->title=title;break;
case 4:scanf("%s",&sex);p->sex=sex;break;
case 5:scanf("%s",&age);p->age=age;break;
case 6:scanf("%s",&telephone);p->telephone=telephone;break;
case 0:break;
}
}
}
if(judge=1)
printf("No information found\n");
printf("1:Go On 0:Return Menu\n");
scanf("%d",&choice);
}
if(choice=0)
void Menu(Link head);
}
void Query(Link head)//查询
{
char num[100];
int judge=1;
int choice=1
Node p=head;
if(choice=1)
{
printf("Please Enter Num\n");
scanf("%s",&num);
while(p != NULL)
{
p=p->next;
if(num==p->num)
{
printf("%s,%s,%s,%s,%s,%s\n",p->num,p->name,p->title,p->sex,p->age,p->telephone);
judge=0;
}
}
if(judge=1)
printf("No information found\n");
printf("1:Go On 0:Return Menu\n");
scanf("%d",&choice);
}
if(choice=0)
void Menu(Link head);
}
调用Menu函数的时候不需要把这个函数的返回值类型也带上,void是多余的:
结构体作为参数的时候,也不需要把类型带上,只需要变量名即可,所以:
要区分指针和非指针:
scanf 写字符串指针的问题:
最后,main 函数应该返回 int,修改为:
int main(){
...
return 0;
}
看代码,可能你 C 语言的很多地方需要补。