C语言学生课程系统菜单完整源码+报告可接定制

在这里插入图片描述
需要完整源码可看昵称练好
下面展示一些 内联代码片

// A code block
var foo = 'bar';
// An highlighted block
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 学生数据类型定义
typedef struct Student {
    int id;
    char name[50];
    char course[50];
} Student;

// 顺序存储
Student students[100];
int studentCount = 0;

// 链式存储
typedef struct Node {
    Student data;
    struct Node *next;
    struct Node* left;
    struct Node* right;
} Node;

Node *head = NULL;

// 增加数据
void addStudent(int id, char name[], char course[]) {
    Student newStudent;
    newStudent.id = id;
    strcpy(newStudent.name, name); // 使用strcpy将name字符串复制到newStudent.name中
    strcpy(newStudent.course, course); // 使用strcpy将course字符串复制到newStudent.course中
    students[studentCount++] = newStudent;
int main() {
    int choice;
    while (1) {
    	printf("****************************************************************\n");
        printf("*                  学生课程系统菜单                            *\n");
        printf("****************************************************************\n");
        printf("*                  1. 增加数据                                 *\n");
        printf("*                  2. 显示数据                                 *\n");
        printf("*                  3. 删除数据                                 *\n");
        printf("*                  4. 修改数据                                 *\n");
        printf("*                  5. 快速排序                                 *\n");
        printf("*                  6. 自选排序                                 *\n");
        printf("*                  7. 二叉排序树查找                           *\n");
        printf("*                  8. 自选查找                                 *\n");
        printf("*                  0. 退出                                     *\n");
        printf("****************************************************************\n");
        printf("请选择功能:");
        scanf("%d", &choice);

        switch (choice) {
            case 1: {
                int id;
                char name[50], course[50];
                printf("输入学生ID: ");
                scanf("%d", &id);
                printf("输入姓名: ");
                scanf("%s", name);
                printf("输入课程: ");
                scanf("%s", course);
                addStudent(id, name, course);
                break;
            }
            case 2: {
                displayStudents();
                break;
            }
            case 3: {
                int id;
                printf("输入要删除的学生ID: ");
                scanf("%d", &id);
                deleteStudent(id);
                break;
            }
            case 4: {
                int id;
                char name[50], course[50];
                printf("输入要修改的学生ID: ");
                scanf("%d", &id);
                printf("输入新的姓名: ");
                scanf("%s", name);
                printf("输入新的课程: ");
                scanf("%s", course);
                modifyStudent(id, name, course);
                break;
            }

    case 5: {
        clock_t start, end;
        double timeUsed;
        start = clock();

        quickSort(students, 0, studentCount - 1);

        end = clock();
        timeUsed = ((double)(end - start)) / CLOCKS_PER_SEC;
        printf("快速排序时间复杂度: %f 秒\n", timeUsed);
        break;
    }
    case 6: {
        clock_t start, end;
        double timeUsed;
        start = clock();

        customSort(students, studentCount);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

徐瑶万正源码,可堪头相,徐福费

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值