C語(yǔ)言實(shí)現(xiàn)考試報(bào)名管理系統(tǒng)
本文實(shí)例為大家分享了C語(yǔ)言實(shí)現(xiàn)考試報(bào)名管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
源代碼:
#include<stdio.h> #include<stdlib.h> #include<string.h>? typedef struct node { ?? ?char name[40]; ?? ?char id[20]; ?? ?char gender[10]; ?? ?char age[10]; ?? ?char tele[20]; ?? ?struct node *pNext; } NODE , *PNODE; void InputElement(PNODE); PNODE CreatList(void); void FindList(PNODE); void AmendList(PNODE); void DeleteList(PNODE); void InsertList(PNODE); int main() { ?? ?PNODE pHead = NULL; ?? ?int opt; ?? ?while(1) { ?? ??? ?system("cls"); ?? ??? ?printf("-------考試報(bào)名管理系統(tǒng)-------\n"); ?? ??? ?printf("1.錄入考生信息\n"); ?? ??? ?printf("2.查找考生信息\n"); ?? ??? ?printf("3.修改考生信息\n"); ?? ??? ?printf("4.刪除考生信息\n"); ?? ??? ?printf("5.插入考生信息\n"); ?? ??? ?printf("0.退出系統(tǒng)\n"); ?? ??? ?printf("請(qǐng)輸入您的操作命令:"); ?? ??? ?scanf("%d" , &opt); ?? ??? ?switch(opt) { ?? ??? ??? ?case 1: ?? ??? ??? ??? ?pHead = CreatList(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ??? ?case 2: ?? ??? ??? ??? ?FindList(pHead); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ??? ?case 3: ?? ??? ??? ??? ?AmendList(pHead); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ??? ?case 4: ?? ??? ??? ??? ?DeleteList(pHead); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ??? ?case 5: ?? ??? ??? ??? ?InsertList(pHead); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ??? ?case 0: ?? ??? ??? ??? ?printf("\n已退出系統(tǒng)!\n"); ?? ??? ??? ??? ?exit(0); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?getchar(); ?? ??? ??? ??? ?break; ?? ??? ?}? ?? ?} ?? ?return 0; } void InputElement(PNODE p) { ?? ?printf("姓名:"); ?? ?scanf("%s" , p->name); ?? ?printf("身份證號(hào):");? ?? ?scanf("%s" , p->id);? ?? ?printf("性別:");? ?? ?scanf("%s" , p->gender); ?? ?printf("年齡:");? ?? ?scanf("%s" , p->age); ?? ?printf("電話號(hào)碼:");? ?? ?scanf("%s" , p->tele);? } PNODE CreatList(void) { ?? ?int i , len; ?? ?PNODE pHead = (PNODE)malloc(sizeof(NODE));? ?? ?PNODE pTail = pHead; ?? ?pTail->pNext = NULL; ?? ?printf("\n請(qǐng)輸入報(bào)考學(xué)生的總?cè)藬?shù):"); ?? ?scanf("%d" , &len);? ?? ?for(i = 0; i < len ; i++) {?? ? ?? ??? ?printf("請(qǐng)輸入第 %d 位考生的相關(guān)信息\n" , i + 1); ?? ??? ?PNODE p = (PNODE)malloc(sizeof(NODE)); ?? ??? ?InputElement(p); ?? ??? ?pTail->pNext = p; ?? ??? ?p->pNext = NULL; ?? ??? ?pTail = p; ?? ?}? ?? ?return pHead; } void FindList(PNODE pHead) { ?? ?char id[20]; ?? ?PNODE p = pHead; ?? ?printf("\n請(qǐng)輸入你要查找的身份證號(hào)碼:"); ?? ?scanf("%s" , id); ?? ?while(p != NULL) { ?? ??? ?if(strcmp(id , p->id) == 0) { ?? ??? ??? ?printf("%s 的信息如下:\n" , p->name); ?? ??? ??? ?printf("身份證號(hào):%s\n" , p->id); ?? ??? ??? ?printf("性別:%s\n" , p->gender); ?? ??? ??? ?printf("年齡:%s\n" , p->age); ?? ??? ??? ?printf("電話號(hào)碼:%s\n" , p->tele); ?? ??? ??? ?return; ?? ??? ?}else if(p->pNext == NULL) { ?? ??? ??? ?printf("未找到考生的相關(guān)信息!\n"); ?? ??? ??? ?return; ?? ??? ?}? ?? ??? ?p = p->pNext; ?? ?} ?? ?return;?? ? } void AmendList(PNODE pHead) { ?? ?char name[40]; ?? ?PNODE p = pHead; ?? ?printf("\n請(qǐng)輸入你要修改的考生姓名:"); ?? ?scanf("%s" , name); ?? ?while(p != NULL) { ?? ??? ?if(strcmp(name , p->name) == 0) { ?? ??? ??? ?printf("%s 的信息如下:\n" , p->name); ?? ??? ??? ?printf("身份證號(hào):%s\n" , p->id); ?? ??? ??? ?printf("性別:%s\n" , p->gender); ?? ??? ??? ?printf("年齡:%s\n" , p->age); ?? ??? ??? ?printf("電話號(hào)碼:%s\n" , p->tele); ?? ??? ??? ?printf("請(qǐng)輸入修改后的考生信息:\n"); ?? ??? ??? ?InputElement(p); ?? ??? ??? ?printf("修改成功!\n");? ?? ??? ??? ?return; ?? ??? ?}else if(p->pNext == NULL) { ?? ??? ??? ?printf("未找到考生的相關(guān)信息!\n"); ?? ??? ??? ?return; ?? ??? ?}? ?? ??? ?p = p->pNext; ?? ?} ?? ?return;?? ? } void DeleteList(PNODE pHead) { ?? ?char name[40]; ?? ?PNODE p = pHead; ?? ?PNODE q = p->pNext; ?? ?printf("\n請(qǐng)輸入要?jiǎng)h除的考生姓名:"); ?? ?scanf("%s" , name); ?? ?while(strcmp(q->name , name) != 0) { ?? ??? ?p = q; ?? ??? ?q = p->pNext; ?? ??? ?if(q == NULL) { ?? ??? ??? ?printf("未找到考生的相關(guān)信息!\n"); ?? ??? ??? ?return; ?? ??? ?} ?? ?} ?? ?p->pNext = q->pNext; ?? ?free(q); ?? ?q = NULL; ?? ?printf("刪除成功!"); ?? ?return; } void InsertList(PNODE pHead) { ?? ?PNODE p = (PNODE)malloc(sizeof(NODE)); ?? ?printf("\n請(qǐng)輸入要插入的考生信息\n"); ?? ?InputElement(p); ?? ?p->pNext = pHead->pNext; ?? ?pHead->pNext = p; ?? ?printf("插入成功!\n"); ?? ?return;? }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
完全掌握C++編程中構(gòu)造函數(shù)使用的超級(jí)學(xué)習(xí)教程
這篇文章主要介紹了C++中的構(gòu)造函數(shù),包括C++11標(biāo)準(zhǔn)中的新特性的介紹,十分推薦!需要的朋友可以參考下2016-01-01C++中constexpr與函數(shù)參數(shù)轉(zhuǎn)發(fā)的操作方法
constexpr是c++11引入的關(guān)鍵字,c++11的constexpr的函數(shù)中只是支持單句代碼,c++14限制放寬,可以在里邊寫循環(huán)及邏輯判斷等語(yǔ)句,本文探討關(guān)于constexpr的函數(shù)中參數(shù)的現(xiàn)象,以及如果參數(shù)是constexpr如何做轉(zhuǎn)發(fā),感興趣的朋友一起看看吧2024-02-02wince程序防止創(chuàng)建多個(gè)實(shí)例實(shí)現(xiàn)互斥作用
什么時(shí)候用的互斥?當(dāng)你的程序只允許同時(shí)打開(kāi)一個(gè)的時(shí)候,就可以通過(guò)互斥來(lái)實(shí)現(xiàn),下面說(shuō)的互斥,主要是針對(duì)防止程序創(chuàng)建多個(gè)實(shí)例這種情況來(lái)實(shí)現(xiàn)的2014-02-02C++ COM編程之QueryInterface函數(shù)(一)
這篇文章主要介紹了C++ COM編程之QueryInterface函數(shù)(一),QueryInterface是組件本身提供對(duì)自己查詢的一個(gè)接口,需要的朋友可以參考下2014-10-10