#include <stdlib.h>
#include <stdio.h>
#define over 0
typedef struct node{
int num,age;
char name[20],sex,addr[30];
float score;
struct node *next;
}node,*LinkList;
void setup(LinkList &i){
int t,g;
int num=g,age;
char name[20],sex,addr[30];
float score;
printf(“请输入需要创建信息的人员个数g:”);
scanf("%d",&g);
i=(node*)malloc(sizeof(node));
i->next=NULL;
for(t=0;t<g;t++){
LinkList p=(node*)malloc(sizeof(node));
printf(“请输入编号:”);
scanf("%d",&num);
printf(“请输入姓名:”);
scanf("%d",&name);
printf(“请输入年龄:”);
scanf("%d",&age);
printf(“请输入性别:”);
scanf("%d",&sex);
printf(“请输入学号:”);
scanf("%d",&addr);
printf(“请输入成绩:”);
scanf("%d",&score);
p->next=i->next;
i->next=p;
}
printf(“创建完毕!”);
}
int charu(node *L,int num){
int j;
int age;
char name[20],sex,addr[30];
float score;
node *p=L,s;
if(num<=0) return 0;
while(j<num-1&&p!=NULL){
j++;
p->next;
}if(p==NULL) return 0;
else{
s=(node)malloc(sizeof(node));
printf(“请输入编号:”);
scanf("%d",&num);
printf(“请输入姓名:”);
scanf("%d",&name);
printf(“请输入年龄:”);
scanf("%d",&age);
printf(“请输入性别:”);
scanf("%d",&sex);
printf(“请输入学号:”);
scanf("%d",&addr);
printf(“请输入成绩:”);
scanf("%d",&score);
s->next=p->next;
p->next=s;
return 0;
}
}
void chaxun(LinkList L){
int n,f;
int num,age;
char name[20],sex,addr[30];
float score;
printf(“1 按编号查找\n 2 按学号查找\n”);
scanf("%d",&n);
if(n1){
LinkList p=L->next;
printf(“请输入要查找的编号:”);
scanf("%d",&f);
int i=1;
while(f!=NULL&&p->num!=f){
p=p->next;
i++;
}
if(fNULL) return 0;
else {
printf("%d",num);
printf("%d",name);
printf("%d",age);
printf("%d",sex);
printf("%d",addr);
printf("%d",score);
}
}else{
LinkList p =L->next;
printf(“请输入要查找的学号:”);
scanf("%d",&f);
int i=1;
while(p!=NULL&&p->addr!=f){
p=p->next;
i++;
}
if(p==NULL) return 0;
else {
printf("%d",num);
printf("%d",name);
printf("%d",age);
printf("%d",sex);
printf("%d",addr);
printf("%d",score);
}
}
}
int shanchu(node *L){
int n,f;
printf(“1 按编号删除\n 2 按学号删除\n”);
scanf("%d",&n);
if(n1){
printf(“请输入要删除的编号”);
scanf("%d",&f);
int j=0;
node *p=L,*q;
if(f<=0) return 0;
while(j<f&&p!=NULL){
j++;
p=p->next;
}if(pNULL) return 0;
else{
q=p->next;
if(qNULL) return 0;
p->next=q->next;
free(q);
return 1;
}
}else{
printf(“请输入要删除的编号”);
scanf("%d",&f);
int j=0;
node *p=L,*q;
if(f<=0) return 0;
while(j<f&&p!=NULL){
j++;
p=p->next;
}if(pNULL) return 0;
else{
q=p->next;
if(q==NULL) return 0;
p->next=q->next;
free(q);
return 1;
}
}
}
void xianshi(LinkList i){
int num,age;
char name[20],sex,addr[30];
float score;
LinkList p;
p=i->next;
printf("** 编号 姓名 年龄 性别 学号 成绩**\n");
while§{
printf("%d",num);
printf("%d",name);
printf("%d",age);
printf("%d",sex);
printf("%d",addr);
printf("%d",score);
}
printf("\n");
}
int jiemian(ListList L){
printf("\n @欢迎使用业务员业绩管理系统");
printf("\n * 1 建立业务员信息表 *");
printf("\n * 2 插入新业务员信息 *");
printf("\n * 3 查询业务员信息记录 *");
printf("\n * 4 删除业务员信息 *");
printf("\n * 5 业务员业绩排序 *");
printf("\n * 6 显示所有业务员信息 *");
printf("\n * 0 退出管理系统 *");
printf("\n @欢迎使用业务员业绩管理系统");
printf("\n 请选择操作:");
printf("\n 请选择0-6:");
int n;
LiskList w;
student a;
scanf("%d",&n);
switch(n){
case 1:setup(w);xianshi(w);
break;
case 2:charu(w);xianshi(w);
break;
case 3:chaxun(w);
break;
case 4:shanchu(w);
break;
case 5:paixu(w);
break;
case 6:xianshi(w);
break;
}if(n==0){
exit(over);
}return 0;
system(“pause”);
}
int main(){
system(“color 3f”);
while(1){
LinkList L;
jiemian(L);
}
}