第一次写,难免会有些紧张 ,这是我们的课程设计作业,拉出来分享下。

/*
    版本号 V1.0
    时间 2014.6.24*/

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
#define SI sizeof(stu)
#define PT "^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^ ^…^\n"
#define ET "|%-15s|%-14ld|%-9s|%-8d|%-8d|%-14ld|%-6.1f|%-6.1f|%-6.1f|%-6.1f|%6.1f|%6.1f|%6.1f|\n绩点:                                                         |%-6.1f|%-6.1f|%-6.1f|%-6.1f|%-6.1f|\n",node->name,node->num,node->sex,node->age,node->bir,node->tel,node->score[0],node->score[1],node->score[2],node->score[3],node->score[4],node->sum,node->ave,node->gpa[0],node->gpa[1],node->gpa[2],node->gpa[3],node->gpa[4]

void clear(void)    //清屏函数
{
    system("clear");
}
typedef struct s
{
    long num;    //学号
    char name[20];    //姓名
    char sex[5];    //性别
    int age;    //年龄
    int bir;        //生日
        long tel;        //电话号码
    float score[5];    //五门成绩
    float ave;    //平均分
    float gpa[5];    //绩点
    float sum;    //总分数
    char pass[15];
    struct s * next;

}stu;

typedef struct passw
{
    long num;
    char pass[15];
    struct passw *next;
}DI;

stu * creat()        //创建链表
{
    stu* head,*node,*new_node;
    FILE *fp;
        fp=fopen("os.txt","w+");
        if((fp==NULL))
        {
                printf("加载失败!\n");
                exit(0);
        }

    head = node = (stu *)malloc(SI);
    new_node = (stu *)malloc(SI);
    printf("\n|学生姓名  |学号  |姓别 |年龄 |生日 |电话号码   |高数 |英语 |离散 |大物 |C语言:\n");
        scanf("%s %ld %s %d %d %ld %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4]);
    int i;
        float sum=0;
        for (i=0;i<5;i++)
        {     
                sum+=new_node->score[i];
                if (new_node->score[i]<60)
                       new_node->gpa[i] = 0;
                else
                       new_node->gpa[i] = new_node->score[i]/10-5;
                
        }
        new_node->ave = sum/5;
    new_node->sum = sum;
while (new_node->num!=0)
{
    node->next = new_node;
    node = new_node;
    new_node = (stu *)malloc(SI);
    printf("\n|学生姓名  |学号  |姓别 |年龄 |生日 |电话号码   |高数 |英语 |离散 |大物 |C语言:\n");
        scanf("%s %ld %s %d %d %ld %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4]);
        int i;
        float sum=0;
        for (i=0;i<5;i++)
        {
                sum+=new_node->score[i];
                if (new_node->score[i]<60)
                       new_node->gpa[i] = 0;
                
                else
                       new_node->gpa[i] = new_node->score[i]/10-5;
                
        }
        new_node->ave = sum/5;
    new_node->sum = sum;
}
node->next = NULL;
free(new_node);
fclose(fp);
return head;
}

void write(stu *head)
{
    stu *new_node;
    new_node = head->next;
    FILE *fp;
    if((fp = fopen("os.txt","w+"))==NULL)
    {
        printf("加载失败!\n");
        exit(0);
    }
while(new_node!=NULL)
{    
    fprintf(fp,"%-15s%-14ld%-9s%-8d%-8d%-14ld%-6.1f%-6.1f%-6.1f%-6.1f%-6.1f%-6.1f%-6.1f%-4.1f%-4.1f%-4.1f%-4.1f%-4.1f\n",new_node->name,new_node->num,new_node->sex,new_node->age,new_node->bir,new_node->tel,new_node->score[0],new_node->score[1],new_node->score[2],new_node->score[3],new_node->score[4],new_node->sum,new_node->ave,new_node->gpa[0],new_node->gpa[1],new_node->gpa[2],new_node->gpa[3],new_node->gpa[4]);
    new_node = new_node->next;

}
    fclose(fp);
}

stu *read(void)        //从文件中读取信息并创建链表
{
     stu* head,*node,*new_node;
    FILE *fp;
        fp=fopen("os.txt","r");
        if((fp==NULL))
        {
                printf("加载失败!\n");
                exit(0);
        }
    head = node = (stu *)malloc(SI);
        new_node = (stu *)malloc(SI);
    fscanf(fp,"%s %ld %s %d %d %ld %f %f %f %f %f %f %f %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4],&new_node->sum,&new_node->ave,&new_node->gpa[0],&new_node->gpa[1],&new_node->gpa[2],&new_node->gpa[3],&new_node->gpa[4]);
    while(!feof(fp))
    {
        node->next = new_node;
        node = new_node;
        new_node = (stu *)malloc(SI);
         fscanf(fp,"\n%s %ld %s %d %d %ld %f %f %f %f %f %f %f %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4],&new_node->sum,&new_node->ave,&new_node->gpa[0],&new_node->gpa[1],&new_node->gpa[2],&new_node->gpa[3],&new_node->gpa[4]);
    }
    node->next = NULL;
    free(new_node);
    fclose(fp);
    return(head);
}

stu *findnum(void)   //其中num为要查找的学生的学号
{
    long num;
    printf("查找的学号:");
    scanf("%ld",&num);
    stu *node;
    node = read();
    while (node->next!=NULL)
    {    
        node = node->next;
        if (node->num == num)
        {       printf(PT);
                        printf(ET);
            return node;
                }

    }
    printf("学生信息未找到!\n");
    return NULL;
    
}

stu *findname(void)   //其中num为要查找的学生的姓名
{
    char name[20];
    printf("查找的姓名:");
    scanf("%s",name);
        stu *node;
        node = read();
    int cmp;
        while (node->next!=NULL)
        {
        node = node->next;
                cmp = strcmp(name,node->name);
        if(cmp == 0)
        {    printf(PT);
                        printf(ET);
            return node;
        }
        }
        printf("学生信息未找到!\n");
    return 0;
        
}

void find()
{
    printf("\t\t\t1.姓名查找.\n\t\t\t2.学号查找.\n\t\t\t0.回到上层.\n");
    int i;
    scanf("%d",&i);
    switch(i)
    {
        case 1: findname();break;
        case 2: findnum();break;
        case 3: begin();break;
        default :printf("错误!\n");begin();
    }
}

stu *deletenum(void)
{
    long num;
    printf("输入要删除学生的学号:");
    scanf("%ld",&num);
    stu *head,*node,*no;
    head = no = read();
    node = no->next;
    while(node!=NULL)
       { if(node->num==num)
        {
            no->next = node->next;
            free(node);
            printf("删除成功!\n");
            write(head);
            return head;
        }
         no = node;
         node = node->next;
       }
       printf("删除失败!\n");
}

stu *deletename(void)
{
        char name[20];
        printf("输入要删除学生的姓名:");
        scanf("%s",name);
        stu *head,*node,*no;
        head = no = read();
        node = no->next;
        while(node!=NULL)
           { if(strcmp(node->name,name)==0)
                {
                        no->next = node->next;
                        free(node);
                        printf("删除成功!\n");
                        write(head);
                        return head;
                }
             no = node;
             node = node->next;
           }
           printf("删除失败!\n");
}

void delete()
{
        printf("\t\t\t1.按学号删除.\n\t\t\t2.按姓名查找.\n\t\t\t0.回到上层.\n");
        int i;
        scanf("%d",&i);
        switch(i)
        {
                case 1: deletenum();break;
                case 2: deletename();break;
                case 3: begin();break;
                default :printf("错误!\n");begin();
        }
}

stu* sortsum()
{
    stu *head = read();
    stu *p,*q,*pt,*t;
    t = (stu *)malloc(SI); // 创建临时结点
    t->next = head; // 临时结点作为链表临时头指针
    for(p = head; p->next!=NULL; p = p->next)
    {
        q = p->next;
        while(q->next!=NULL)
        {
            if(p->next->sum < q->next->sum)
            {
                pt = p->next;
                p->next = q->next;
                q->next = p->next->next;
                p->next->next = pt;
            }
            else q = q->next;
        }
    }
    head = t->next;
    free(t);
    write(head);
    return head;

}

stu* sortnum()
{
    stu *p,*q,*pt,*t,*head;
    head = read();
    t = (stu *)malloc(SI); //
    t->next = head; //
    for(p = head; p->next!=NULL; p = p->next)
    {
        q = p->next;
        while(q->next!=NULL)
    {
            if(p->next->num > q->next->num)
        {
                pt = p->next;
                p->next = q->next;
                q->next = p->next->next;
                p->next->next = pt;
            }
            else q = q->next;
        }
    }
    head = t->next;
    free(t);
    write(head);
}

stu* add(void)
{
    DI *fr();
    FILE *fp;
    if ((fp = fopen("pass.txt","a+"))==NULL)
        {
                printf("打开文件失败!\n");
                exit(0);
        }
    stu *head,*new_node,*node;
    DI *head1;
    DI *node1,*new_node1;
    head = read();
    head1 = fr();
    node = head->next;
    node1 = head1->next;
    while (node1->next!=NULL)
        node1 = node1->next;
    while(node->next!=NULL)
        node = node->next;
    new_node = (stu *)malloc(SI);
    printf("\n|学生姓名  |学号  |姓别 |年龄 |生日 |电话号码   |高数 |英语 |离散 |大物 |C语言:\n");
        scanf("%s %ld %s %d %d %ld %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4]);
    int i;
        float sum=0;
        for (i=0;i<5;i++)
        {
                sum+=new_node->score[i];
                if (new_node->score[i]<60)
                       new_node->gpa[i] = 0;

                else
                       new_node->gpa[i] = new_node->score[i]/10-5;

        }
        new_node->ave = sum/5;
        new_node->sum = sum;
    new_node1 = (DI *)malloc(sizeof(DI));
    new_node1->num = new_node->num;
    strcpy(new_node1->pass,"000000");
    fprintf(fp,"%ld %s\n",node->num,new_node1->pass);
    while (new_node->num!=0)
{
    node->next = new_node;
    node1->next = new_node1;
    node = new_node;
    node1 = new_node1;
    new_node = (stu *)malloc(SI);
        printf("\n|学生姓名  |学号  |姓别 |年龄 |生日 |电话号码   |高数 |英语 |离散 |大物 |C语言:\n");
        scanf("%s %ld %s %d %d %ld %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4]);
    int i;

        {
                sum+=new_node->score[i];
                if (new_node->score[i]<60)
                       new_node->gpa[i] = 0;

                else
                       new_node->gpa[i] = new_node->score[i]/10-5;

        }
        new_node->ave = sum/5;
        new_node->sum = sum;
    new_node1 = (DI *)malloc(sizeof(DI));
        new_node1->num = new_node->num;
        strcpy(new_node1->pass,"000000");
    fprintf(fp,"%ld %s\n",node->num,new_node1->pass);
}
    node->next = NULL;
    free(new_node);
    free(new_node1);
    write(head);
    fclose(fp);
    printf("文件插入保存成功");
    return head;
}

void mod()
{
    stu *new_node,*node,*head,*no;
    new_node = (stu *)malloc(SI);
    printf("输入要修改学生的信息\n|学生姓名  |学号  |姓别 |年龄 |生日 |电话号码   |高数 |英语 |离散 |大物 |C语言:\n");
    scanf("%s %ld %s %d %d %ld %f %f %f %f %f",new_node->name,&new_node->num,new_node->sex,&new_node->age,&new_node->bir,&new_node->tel,&new_node->score[0],&new_node->score[1],&new_node->score[2],&new_node->score[3],&new_node->score[4]);
    int i;
        float sum=0;
        for (i=0;i<5;i++)
        {
                sum+=new_node->score[i];
                if (new_node->score[i]<60)
                       new_node->gpa[i] = 0;

                else
                       new_node->gpa[i] = new_node->score[i]/10-5;

        }
        new_node->ave = sum/5;
        new_node->sum = sum;
    no = head = read();
    node = head->next;
    while (node!=NULL)
        {
            if (node->num == new_node->num)
            {    new_node->next = node->next;
                no->next = new_node;
                free(node);
                printf("学生信息修改成功!\n");
                
            }
        node = node->next;
        no = no->next;
        }
    write(head);
    
}

void print(stu *node)
{
    while(node!=NULL)
    {
    if(node->num == 0)
    {    node= node->next;
        continue;
    }
    printf(ET);
    node = node->next;
    
    }    
}

void upst(void)
{
    printf("\t\t任意键返回.\n");
    getchar();
    getchar();
}

void sta(void)
{
    sortsum();
    stu *head,*node,*new_node;
    head = read();
    int a[5]={0};
    node = head->next;
    while (node!=NULL)
    {
        if (node->gpa[0]==0) a[0]++;
        if (node->gpa[1]==0) a[1]++;
        if (node->gpa[2]==0) a[2]++;
        if (node->gpa[3]==0) a[3]++;
        if (node->gpa[4]==0) a[4]++;
        node = node->next;

    }
    print(head);
    printf("其中高数挂科%d个.\n英语挂科%d个.\n离散挂科%d个.\n大物挂科%d个.\nC语言挂科%d个.\n",a[0],a[1],a[2],a[3],a[4]);
    node = head->next;
    printf("以下是成绩最高学生的信息:\n");
    printf(PT);
    printf(ET);

}

int repas(void)
{
    stu *head,*node;
    head = read();
    FILE *fp;
    if ((fp = fopen("pass.txt","w+"))==NULL)
    {
        printf("打开文件失败!\n");
        exit(0);
    }
    node = head->next;
    while(node!=NULL)
    {
        strcpy(node->pass,"000000");
        fprintf(fp,"%ld %s\n",node->num,node->pass);
        node = node->next;
    }
    printf("密码重置成功!\n");
    fclose(fp);
    sleep(1);
    clear();
}

DI *fr()
{
    FILE *fp;
    if((fp = fopen("pass.txt","r"))==NULL)
    {
        printf("文件读取失败!\n");
        exit(0);
    }
    DI *head,*node,*new_node;
    head = node = (DI *)malloc(sizeof(DI));
    new_node = (DI *)malloc(sizeof(DI));
    fscanf(fp,"%ld %s",&new_node->num,new_node->pass);
    while (!feof(fp))
    {
        node->next = new_node;
        node = new_node;
        new_node = (DI *)malloc(sizeof(DI));
        fscanf(fp,"\n%ld %s",&new_node->num,new_node->pass);
    }
    node->next = NULL;
    free(new_node);
    fclose(fp);
    return head;
}
void fw(DI *head)
{
    FILE *fp;
        if((fp = fopen("pass.txt","w+"))==NULL)
        {
                printf("文件读取失败!\n");
                exit(0);
        }

    DI *node;
    node = head->next;
    while(node!=NULL)
    {
        fprintf(fp,"%ld %s\n",node->num,node->pass);
        node = node->next;
    }
    fclose(fp);
}

int password()
{
    DI *head1,*node1;
    long n;
    int i=3;
    char p[15];
    head1 = fr();
    node1 = head1->next;
while(1)
{
    printf("\t\t用户名:");
                scanf("%ld",&n);
                printf("\n\t\t密码:");system("stty -echo");
                scanf("%s",p);system("stty echo");
    while(node1!=NULL)
    {
        if (node1->num==n&&strcmp(node1->pass,p)==0)
        {
            while (1)
            {
            studbe(node1->num);
            }
            return 1;
            
        }
        node1 = node1->next;
    

    }
        i--;
                if (i==0)
                        exit(1);
        printf("您还可以输入%d次!\n",i);
        node1 = head1->next;



}        
}

void stud(long num)
{
    stu *head,*node;
    int i=1,j,lo=0;
    sortsum();
    head = read();
    node = head->next;
    while(node->num!=num)
    {    i++;
        node = node->next;
    }
    for (j=0;j<5;j++)
    {
        if(node->gpa[j]==0)
            lo++;
    }
    printf("PT");
    printf(ET);
    printf("您的成绩在整个年级排第%d位.\n有挂科%d门.\n",i,lo);
}

int password1()
{
    char pass[20],pas[20];
    int i=3;
    clear();
    FILE *fp;
    if((fp = fopen("pass","r"))==NULL)
        {
                printf("文件读取失败!\n");
                exit(0);
        }
    fscanf(fp,"%s",pas);
    while(1)
    {    printf("\t\t账号:admin");
            printf("\t\t密码:");system("stty -echo");
            scanf("%s",pass);system("stty echo");
        if(strcmp(pas,pass)==0)
        {    while (1)
                begin();
                return 1;
        }
        i--;
        if (i==0)
            exit(0);
        printf("您还有%d次输入机会!\n",i);

    }
    

    

}

void pas(long num)
{
    clear();
    char a[20],b[20],c[20];
    DI *head,*node;
    head = fr();
    printf("\t\t输入原始密码:");system("stty -echo");
    scanf("%s",a);system("stty echo");
    printf("\n\t\t输入新密码:");system("stty -echo");
    scanf("%s",b);system("stty echo");
        printf("\n\t\t再次输入新密码:");system("stty -echo");
    scanf("%s",c);system("stty echo");
    node = head->next;
    while(node!=NULL)
    {
        if (node->num==num)
            {if (strcmp(node->pass,a)==0&&strcmp(b,c)==0)
            {    strcpy(node->pass,b);
                fw(head);
                printf("密码修改成功!\n");
                break;
            }
            else printf("原密码输入错误或两次新密码不一致,请重试!\n");}
        node = node->next;
        
    }    
}

studbe(long num)
{
clear();
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t*******************************************************************************************************\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t========|||       **    **               *************                   *         *****    |||========\t\t\n");
printf("\t\t\t========|||    **************                *   *                       *         *  *     |||========\t\t\n");
printf("\t\t\t========|||   ****************           *************             * * * * * * *   * *      |||========\t\t\n");
printf("\t\t\t========|||    **************            *   *   *   *             *     *     *   *  *     |||========\t\t\n");
printf("\t\t\t========|||      **********              * * *   * * *             * * * * * * *   * **     |||========\t\t\n");
printf("\t\t\t========|||        ******                *           *             *     *     *   *        |||========\t\t\n");
printf("\t\t\t========|||          **                  * * * * * * *             * * * * * * *   *        |||========\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t******************************====================================*************************************\t\t\n");
printf("\t\t\t===========================|||欢迎来到西安邮电大学学生信息查询系统|||==================================\t\t\n");
printf("\t\t\t===========================|||              请选择                |||==================================\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t                           ||| 1.查询自己的信息.                |||\n");
printf("\t\t\t                           ||| 2.修改密码.                      |||\n");
printf("\t\t\t                           ||| 0.退出.                          |||\n");
printf("\t\t\t                           ========================================\n");
int i;
printf("\n\t\t\t");
scanf("%d",&i);
switch(i)
        {
                case 1 : clear();stud(num);upst();break;
                case 2 : clear();pas(num);upst();break;
        case 0 : printf("\t\t\t谢谢使用,再见!\n");system("sl");clear();exit(0);
    }
}

void admin(void)
{

        clear();
        char a[20],b[20],c[20],d[20];
    FILE *fp;
     if ((fp = fopen("pass","r"))==NULL)
        {
                printf("打开文件失败!\n");
                exit(0);
        }
    fscanf(fp,"%s",d);
    fclose(fp);
        printf("\t\t输入原始密码:");system("stty -echo");
        scanf("%s",a);system("stty echo");
        printf("\n\t\t输入新密码:");system("stty -echo");
        scanf("%s",b);system("stty echo");
        printf("\n\t\t再次输入新密码:");system("stty -echo");
        scanf("%s",c);system("stty echo");
                        if (strcmp(d,a)==0&&strcmp(b,c)==0)
                            {
                fp = fopen("pass","w+");
                                fprintf(fp,"%s",c);
                                printf("密码修改成功!\n");
                            }
                        else printf("原密码输入错误或两次新密码不一致,请重试!\n");
    fclose(fp);
        


}

int pa(void)
{
char pass[20],pas[20];
        int i=3;

FILE *fp;
        if((fp = fopen("pass","r"))==NULL)
        {
                printf("文件读取失败!\n");
                exit(0);
        }
        fscanf(fp,"%s",pas);
        while(1)
        {       printf("\t\t账号:admin");
                printf("\t\t密码:");system("stty -echo");
                scanf("%s",pass);system("stty echo");
                if(strcmp(pas,pass)==0)
                {    
                                creat();
                                return 1;
                }
                i--;
                if (i==0)
                        exit(0);
                printf("您还有%d次输入机会!\n",i);
}    
}

void repass()
{
    clear();
    int i;
    printf("\t\t1.更改管理员密码\n\t\t2.重置学生登录密码(慎重).\n\t\t3.删除所有学生信息并重新创建(慎重)\n\t\t0.返回上一层\n\t\t");
    scanf("%d",&i);
    switch(i)
        {
                case 1 : clear();admin();upst();break;
                case 2 : clear();repas();upst();break;
        case 3 : clear();pa();break;
                case 0 : begin();break;
        }


}

begin()
{
stu *head,node,new_node;
clear();
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t*******************************************************************************************************\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t========|||       **    **               *************                   *         *****    |||========\t\t\n");
printf("\t\t\t========|||    **************                *   *                       *         *  *     |||========\t\t\n");
printf("\t\t\t========|||   ****************           *************             * * * * * * *   * *      |||========\t\t\n");
printf("\t\t\t========|||    **************            *   *   *   *             *     *     *   *  *     |||========\t\t\n");
printf("\t\t\t========|||      **********              * * *   * * *             * * * * * * *   * **     |||========\t\t\n");
printf("\t\t\t========|||        ******                *           *             *     *     *   *        |||========\t\t\n");
printf("\t\t\t========|||          **                  * * * * * * *             * * * * * * *   *        |||========\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t******************************====================================*************************************\t\t\n");
printf("\t\t\t===========================|||欢迎来到西安邮电大学学生信息管理系统|||==================================\t\t\n");
printf("\t\t\t===========================|||              请选择                |||==================================\t\t\n");
printf("\t\t\t=======================================================================================================\t\t\n");
printf("\t\t\t                           ||| 1.预览所有学生信息.                |||\n");
printf("\t\t\t                           ||| 2.查找学生信息.                    |||\n");
printf("\t\t\t                           ||| 3.添加学生信息.                    |||\n");
printf("\t\t\t                           ||| 4.删除学生信息.                    |||\n");
printf("\t\t\t                           ||| 5.修改学生信息.                    |||\n");
printf("\t\t\t                           ||| 6.统计学生信息.                    |||\n");
printf("\t\t\t                           ||| 7.重置.                            |||\n");
printf("\t\t\t                           ||| 0.退出程序                         |||\n");
printf("\t\t\t                           ==========================================\n");
int i;
printf("\t\t\t");
scanf("%d",&i);
switch(i)
        {
                case 1 : clear();sortnum();head = read();print(head);upst();break;
                case 2 : clear();find();upst();break;
                case 3 : clear();add();upst();break;
                case 4 : clear();delete();upst();break;
                case 5 : clear();mod();upst();break;
                case 6 : clear();sta();upst();break;
                case 7 : clear();repass();break;
                case 0 : printf("\t\t\t谢谢使用,再见!\n");system("sl");clear();exit(0);
        }

}

int main(void)
{
    clear();
        printf("\t\t<选择登陆方式>\n\t\t1.管理员登陆.\n\t\t2.学生登陆.\n\t\t0.退出程序");
    int i;
    printf("\t\t\t");
    scanf("%d",&i);
    switch(i)
        {
                case 1 : clear();password1();break;
                case 2 : clear();password();break;
        case 0 : printf("谢谢使用!\n");sleep(3);exit(0);
    }
}


Logo

快速构建 Web 应用程序

更多推荐