学生管理信息系统的问题,求大神指点..
#include<stdio.h>#include<stdlib.h>
#include<string.h>
struct Student
{
char no[8];
char name[10];
char sex[5];
char major[15];
//struct Student *next;
};
//定义学生结点
struct Node
{
struct Student data;.
struct Node *next;
};
struct Node *head=NULL; //头结点
struct Node *curr=NULL; //当前结点
void AddStuInfo();
void DelStuInfo();
void Exit();
void ViewAStuInfo();
void ViewAllStuInfo();
void ShowMainMenu();
void main()
{
int choice;
while(1)
{
ShowMainMenu();
scanf("%d",&choice);
switch(choice)
{
case 1: AddStuInfo();break;
case 2: DelStuInfo();break;
//case 3: ModStuInfo();break;
case 3: ViewAStuInfo();break;
case 4: ViewAllStuInfo();break;
case 5: Exit();break;
default: printf("Please input again.\n");
}
}
}
void ShowMainMenu()
{
printf("Welcome to Student Management System.\n");
printf("1.Add a student infomation.\n");
printf("2.Del a student infomation.\n");
printf("3.View a student infomation.\n");
printf("4.View all students infomation.\n");
printf("5.Exit.\n");
printf("Select:\n");
}
void AddStuInfo()
{
struct Node *p=NULL;
p = (struct Node *) malloc(sizeof(struct Node));
printf("请输入学号:\n");
scanf("%s",p->data.no);
printf("请输入姓名:\n");
scanf("%s",p->data.name);
printf("请输入性别:\n");
scanf("%s",p->data.sex);
printf("请输入专业:\n");
scanf("%s",p->data.major);
p->next=head;
head=p;
}
void DelStuInfo()
{}
void Exit()
{
printf("Exit Success!\n");
exit(0);
}
void ViewAStuInfo()
{
}
void ViewAllStuInfo()
{
if(head==NULL)
printf("无学生信息\n");
else
{
curr=head;
printf("学号 姓名 性别 专业\n");
while(curr!=NULL)
{
printf("%s %s %s %s\n",curr->data.no,curr->data.name,curr->data.sex,curr->data.major);
curr=curr->next;
}
}
}
DelStuInfo()
ViewAStuInfo()
这两个函数不会写,求大神帮帮忙,指点指点,小弟懂的不是很多,就在我这程序基础上写吧
就是写完之后能在这基础上运行就好。
感激不尽。