学生成绩管理系统 C语言链表版本

这是一个使用C语言编写的学生成绩管理系统,通过链表结构存储学生信息,具备一定的错误处理能力。提供了源代码下载链接,便于读者研究和学习。
摘要由CSDN通过智能技术生成

博客搬家了,最近同时更新,没准什么时候就完全搬走了-_-
http://blog.just666.cn 这个是新博客地址,希望大家多多关照

可以实现管理学生姓名学号成绩信息,有一定的容错能力。
源代码下载地址(http://www.oschina.net/code/snippet_2309129_46342%20%E2%80%9Clink%E2%80%9D)

/*********************************************************
*程序描述:学生成绩管理系统
*运行环境:Windows 7 SP1 X64
*开发环境:CodeBlocks with Win7
*作者:耗子、
*时间:2015.03
**********************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

const int TRUE = 1;
const int FALSE = 0;
const char BACK[] = "back";

typedef struct Student  //链表元素
{
    char name[100], number[100];
    double chinese, math, english;
    struct Student* next;
}LNode, *Student;

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓声明函数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓//
Student initLinkList();//初始化
void insLinkList(Student* pHead, char name[],//插入元素
                  char number[], double chinese,
                  double math, double english);
int  delLinkList(Student* pHead, char number[]);//删除元素
int  listLength(Student* pHead);//获取链表长度
int  findLinkList(Student* pHead, char number[]);//查找元素,返回位置
int  modLinkList(Student* pHead, char number[],//修改元素
                 double chinese, double math,
                 double english);
void   outPutLinkList(Student* pHead);//输出所有信息
double scoreLegal(char score[]);//判断分数合法
int    nameLegal(char name[]);//判断姓名合法
int    numberLegal(char number[]);//判断学号合法
int    emptyLinkList(Student* pHead);//判断链表是否为空

void swapNode(Student p, Student q);//负责交换
void putMain();//输出主UI
void putSort();//输出排序UI
int  isBack(char str[]);//判断返回
void error(char []);//错误警告
void welcome();//欢迎
void bay();//再见
//↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑声明函数↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑//

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓主函数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓//
int main()
{
    system("color 0A");
    system("mode con cols=80 lines=25");
    Student pHead;
    Student q, p;
    char name[100], number[100], chinese[100], math[100],
    english[100];
    int op, n;                  //op是选择的选项
    double cn, ma, eng;
    int i, j, sum;
    pHead = initLinkList();
    welcome();
    while (1)
    {
        begin:
        q = pHead;
        putMain();
        op = (getch() - '0' );
        if (op == -1)
            continue;
        switch (op)
        {
            case 0://退出
            {
                bay();
                return 0;
            }
            case 1://添加信息
            {
                for (;;)
                {
                    printf ("\n\t\t\t叫什么?");
                    gets(name);
                    if (isBack(name))
                        goto begin;
                    if (nameLegal(name) == 0)
                        continue;
                    else
                        break;
                }
                number:
                for (;;)
                {
                    printf ("\t\t\t学号呢?");
                    gets(number);
                    if (isBack(number))
                        goto begin;
                    if (numberLegal(number) == 0)
                        continue;
                    else
                        break;
                }
                while (q != NULL)
                {
                    if (strcmp(q->number, number) == 0)
                    {
                        error("学号重复了噻~");
                        goto number;
                    }
                    else
                        q = q->next;
                }
                for (;;)
                {
                    printf ("\t\t\t语文多少分?\n\t\t\t");
                    gets(chinese);
                    if (isBack(chinese))
                        goto begin;
                    cn = scoreLegal(chinese);
                    if (cn == -1)
                        continue;
                    else
                        break;
                }
                for (;;)
                {
                    printf ("\t\t\t数学呢?\n\t\t\t");
                    gets(math);
                    if (isBack(math))
                        goto begin;
                    ma = scoreLegal(math);
                    if (ma == -1)
                        continue;
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值