C語言課程設計報告

2021-08-05 20:31:15 字數 2343 閱讀 8379

一.程式主要功能

用單向鍊錶結構實現簡單的學生成績管理功能,具有鍊錶建立、鍊錶輸出、結點有序插入、結點刪除、資料查詢等功能。

使用者在主選單介面輸入選項,即按照功能列表0-9輸入任意數字,回車後執行該功能。

(1)create list(建立有序單向鍊錶)

從鍵盤上一次輸入乙個學生的姓名及成績,以姓名為序建立有序鍊錶。插入一條記錄後,顯示提示資訊:確認是否輸入下一條記錄,如確認,繼續輸入,否則退出輸入功能。

(2)display all record(顯示所有結點記錄)

按順序顯示鍊錶中所有記錄,每屏顯示10條記錄。每顯示10條,按鍵繼續顯示下一屏。

(3)insert a record(插入一條結點記錄)

在以姓名為序排列的鍊錶中插入一條記錄,插入後,鍊錶仍有序。輸出插入成功的資訊。

(4)delete a record(按姓名查詢,刪除一條結點記錄)

輸入待刪除記錄的姓名,顯示提示資訊,使用者再次確認是否要刪除。確認後,將該姓名的記錄刪除。

(5)query(查詢並顯示乙個結點記錄)

輸入姓名,查詢該記錄,並顯示該同學的成績。

(6)add records from a text file(從正文檔案中新增資料到鍊錶中)

從純文字檔案新增資料到鍊錶。

(7)write to a text file

將鍊錶中資料寫入檔案(純文字文件),鍵入檔名後建立該檔案。

(0)quit(退出學生成績管理系統)

釋放鍊錶儲存空間。

#include

#include

#include

#include

struct stud /*定義結構體*/

;typedef struct stud student; /*宣告新的型別名student*/

int menu_select(); /*宣告全體函式*/

student *create();

void display(student *head);

student *insert(student *head,student *s);

student *insert_a_record(student *head);

student *delete(student *head,char *name);

student *delete_a_record(student *head);

student *query(student *head,char *name);

void query_a_record(student *head);

student *addfromtext(student *head,char *filename);

void writetotext(student *head,char *filename);

void quit(student *head);

main主函式*/

}}int menu_select() /*選單選擇函式*/

while(c<'0'||c>'7');

return(c-'0'); /*返回選擇值*/

}student *create(student *head) /*建立鍊錶*/

else

printf("please input the name and score:");

} return head; /*返回頭指標變數*/

}void display(student *head) /*顯示鍊錶資料*/

{ student *p=head; /*通過變數p的改變對應鍊錶中所有的資料*/

int i=1;

printf("student name score\n");

for(;p!=null;i++)

{ printf("%-15s%d\n",p->name,p->score);

p=p->next;

if(i%10==0)

{system("pause"); /*輸出10個暫停一次*/

system("cls");

printf("function list\n");

printf("1.creat list\n");

printf("2.display all record\n");

printf("3.insert a record\n");

printf(" a record\n");

printf("5.query\n");

printf("6.add records from a text file\n");

printf("7.write to a text file\n");

C語言課程設計報告

課程名稱計算機高階語言課程設計 c 教師姓名 本科生姓名 本科生學號 本科生專業機械設計製造及其自動化 所在院系機電學院 類別c.本科生 日期2013.7.11 注 1 無評閱人簽名成績無效 2 必須用鋼筆或原子筆批閱,用鉛筆閱卷無效 3 如有平時成績,必須在上面評分表中標出,並計算入總成績。模擬手...

C語言課程設計報告

1.本頁為設計報告要求頁,製作好報告後輸出時將本頁刪除 2.本模板的各種字型及頁面設定請同學們 3.本設計報告左側裝訂。在虛線處裝訂。4.在課程設計封皮一頁上用已經設定好的宋體四號來填寫各個專案。5.在課程設計評定表一頁上用宋體小四填寫班級 學號 姓名 專案組 專案組長 專案組組員 本人工作簡介。組...

C語言課程設計報告

電氣與資訊工程學院 c語言程式設計 課程設計報告 課程設計題目 酒店房間登記與計費管理 專業自動化 班級t1023 6 姓名師曉義 1 需求分析 1 問題 根據需求,該系統所應包含的資訊有以下一些 酒店房間登記與計費管理的基本資訊 客戶姓名 身份證號 開始入住時間 退房時間 入住房間號 房間 入住費...