導航:首頁 > 源碼編譯 > c編譯簡單的考試系統

c編譯簡單的考試系統

發布時間:2023-09-17 01:08:14

A. 用C語言編寫一個簡單的成績管理系統

(ps:沒有自己編譯過)

//我寫 C++比較多

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <conio.h>

#define TOTAL_STUD 1000

typedef struct stud {

char name[20];

int score;

} students[TOTAL_STUD],sorted[TOTAL_STUD];

void delstud (int i) {

students[i].name = "無效學生";

students[i].score = -999;

return;

}

#define show(listname,i)printf("%04d%s%d ",i,listname[i].name,listname[i].score);

int cmpfunc (const void * a, const void * b)
{
return ( *(stud*)a.score - *(stud*)b.score );
} // 本段代碼修改自此處

void run(int menu) {

switch (menu) {

case 1:

char uname[20];

int uid,uscore;

printf("請輸入學生姓名:");

scanf("%s",uname);

printf(" 請輸入學生學號:");

scanf("%d",&uid);

printf(" 請輸入學生成績:");

scanf("%d",&uscore);

students[uid].name = uname;

students[uid].score = uscore;

printf(" 插入成功! ");

break;

case 2:

int delid;

printf("要刪除誰?學號?");

scanf("%d",&delid);

delstud(delid);

break;

case 3:

for (int i = 0; i < TOTAL_STUD; i++) {

strcpy(sorted[i].name,students[i].name);

sorted[i].score=students[i].score;

}

qsort(sorted,TOTAL_STUD,sizeof(stud),cmpfunc);

printf("學號 姓名 分數 ");

for (int i = 0; i < TOTAL_STUD; i++) {

if (sorted[i].score > -900) show(sorted,i);

}

break;

case 4:

for (int i = 0; i < TOTAL_STUD; i++) {

if (students[i].score > -900) show(students,i);

}

break;

case 5:

int delid;

printf("要查詢誰?學號?");

scanf("%d",&delid);

show(students,delid);

break;

default:

printf("-- %d 無此功能。請重試。--",menu);

}

return;

}

int main() {

int key = -1;

for (int i = 0; i < TOTAL_STUD; i++) {

delstud(i);

}

while (key != 0) {

printf("---成績管理系統 V0.9 --- 請選擇: 1 -- 錄入 2 -- 刪除 3 -- 排序輸出 4 -- 不排序輸出 5 -- 查詢 0 -- 退出");

key=getch()-48;

if (key>0) run(key);

else {

printf("謝謝使用!再見!");

return 0;

}

}

return 0;

}

B. 用c語言編一簡單在線考試系統

網路搜索 育仁在線考試系統 ,就能找到你需要的資料和方案

閱讀全文

與c編譯簡單的考試系統相關的資料

熱點內容
數字英雄對程序員的影響 瀏覽:758
程序員培訓學校排名 瀏覽:583
oppo手機如何解開微信的加密 瀏覽:33
學校論文答辯源碼 瀏覽:63
rp在單片機中 瀏覽:175
linux軟體運行命令 瀏覽:353
stcid加密程序 瀏覽:136
把解壓包子放到水裡 瀏覽:283
phpmongodb連接池 瀏覽:943
日本解壓捏泡泡紙 瀏覽:118
環保參比演算法 瀏覽:411
解壓中的刪掉是什麼意思 瀏覽:764
王牌競速什麼時候能停止維修伺服器 瀏覽:486
pdf閱讀器官方 瀏覽:85
程序員那麼愛心 瀏覽:304
字元a經過md5加密 瀏覽:417
綠色的小蝴蝶是個什麼app 瀏覽:15
python編程輸入數字輸出年月日英文 瀏覽:628
程序員槍手 瀏覽:748
gm28伺服器怎麼設置 瀏覽:544