微機課設學生成績管理系統
❶ 求一個學生成績管理系統課設
用什麼語言做?我有asp的學生信息管理系統,裡面有學生成績管理的模塊。剛剛畢設做完的,可運行
❷ 學生成績管理系統的課程設計要怎麼做
學生成績管理系統
俺做好了。需要來取。。
❸ 程序設計一個學生成績管理系統~~~
|依靠Baihi聯系
有時間能處理你的題目
我們可以根據本要求提供一份相當於學生水平的源代碼內
6 |容 ES:\\
5 | 交易提醒:預付定金有風險
7 |
1 | 北京易軟個人軟體
5 | 全職軟體開發團隊
6 | 十年信譽鑄成品質
1 | 速度專業積累效率
5 | 開發信息管理系統更有優惠
❹ 設計一個簡單的學生成績管理系統,
我沒寫,只能和你說說怎麼寫。
可以由類模板和數組寫。
我說說類模板的吧。
定義一個Student類存放學生信息(姓名,初始排名,各科成績,個人總分);
初始排名由輸入順序排,在計算名字的時候就可以通過冒泡排序。
在裡面定義計算總分的函數。
下面定義一個Caozuo類,用學生鏈表的做。你可以去找下這個例子。
數組的就很簡單了,你只要想想。先定義數組(姓名,成績),總分就是個人每科成績的和,下面5個函數都可以通過數組遍歷實現。如
cout<<"請輸入你要查詢的學生的名字:"<<endl;
cin>>n;
for(int i=0;i<=Maxsize;i++)
{
if(Student[i].name==n)
Student[i].Print();
}
❺ c語言課程設計 學生成績管理系統
我來幫你~\(≧▽≦)/~啦,請問問題解決了嗎?
❻ 求(C語言課程設計)學生成績管理系統
#include "stdio.h"
#include "conio.h"
#include "string.h"
#include "stdlib.h"
#define CMD_START printf("\n\n######### Start a command #########\n");
/* 用來標記一個命令執行的開始 */
#define CMD_END printf( "\n######### End a command #########\n\n");
/* 用來標記一個命令執行的結束
,這兩個語句是為了提供更好的用戶界面而寫的 */
#define DATA_FILE "data.dat"
/* 這是 數據文件名 */
#define TEMP_FILE "temp.dat"
/* 這是一個臨時的文件的名字,在刪除記錄的函數中使用的,
詳細內容參考 Delete() 函數 */
typedef struct tagStudent
{
char ID[30]; /* 學號 */
char Name[30]; /* 姓名 */
char Class[255]; /* 班級 */
char Sex; /* 性別 ,值為 F 或 f 或 M 或 m */
int Math; /* 數學成績 */
int English; /* 英語成績 */
int Compute; /* 計算機成績 */
int Philosophy; /* 哲學成績 */
int PE; /* 體育成績 */
} Student;
/* 這是學生信息結構體 */
int ShowMenu(); /* 在屏幕上列印 主菜單
的函數,它的返回值為 所選
菜單的 項目編號 */
int ReadData(FILE *, Student *); /* 從一個
打開的數據文件中讀取
記錄的函數,錯誤返回 0 */
int WriteData(FILE *, Student *); /* 向一個數據文件中 寫入
記錄的函數,錯誤返回 0 */
void Output_Rec(Student *); /* 在屏幕上 列印 一條記錄 */
void Input_Rec(Student *); /* 讓用戶輸入 記錄的 各個項目的
值,在添加記錄時用到了 */
void CopyRec(Student *, Student *); /* 復制一條記錄 到
另一個記錄中 */
/* 題目中要求的函數 */
void Print(); /* 實現查看數據文件內容的函數 */
void Add(); /* 添加記錄的函數 */
void Delete(); /* 刪除記錄的函數 */
void Statistics(); /* 對數據進行統計分析的函數 */
void Find(int); /* 實現查找功能的函數,參數決定
是按 ID 查找 還是按 Name 查找 */
int quit; /* 一個全局變數,在下面的 main()
函數中,用來決定何時退出主循環
*/
main()
{
int cmd; /* 用戶所選的 菜單 項目 的標號 */
quit = 0; /* 初始化 為 不退出 */
/* 這是程序的主循環,每次都將 主菜單列印出來,
供用戶選擇相應的 序號 來執行相應的功能 */
while (!quit)
{
cmd = ShowMenu(); /* 顯示
主菜單,並返回用戶所選擇的
菜單項 的 編號 */
CMD_START /* 在屏幕上列印一行分隔符,告訴用戶這是一個子功能的開始
*/
switch (cmd) /* 用多項分支 根據 用戶的選擇
調用 相應的函數 */
{
case 1:
Print();
break; /* 用戶選擇 1 號菜單,程序執行
查看的數據文件的函數 */
case 2:
Add();
break; /* 用戶選擇 2 號菜單,程序執行
添加記錄的函數 */
case 3:
Delete();
break; /* 用戶選擇 3 號菜單,程序執行
刪除記錄的函數 */
case 4:
Statistics();
break; /* 用戶選擇 4 號菜單,程序執行
統計數據的函數 */
case 5:
Find(5);
break; /* Find_ID ,5 號菜單執行 按
ID(學號)查找的功能 */
case 6:
Find(6);
break; /* Find_Name,6 號菜單執行 按
Name(姓名)查找的功能 */
case 7:
quit = 1; /* 用戶選擇了退出菜單 */
printf
(" Thank you for your using .\n\n Happy everyday !!\n\n Bye Bye ....\n");
break;
default:
printf(" Please Input a number between\t1\tto\t7.\n");
/* 用戶所輸入的 序號不在所處理的范圍內 */
}
CMD_END /* 列印一行分隔符,告訴用戶
他所選擇的菜單的功能已經執行完畢
*/
if (quit != 1) /* 檢查用戶是否 要求 退出 */
{
printf(" Press any key to Return Main Menu ....\n");
getch(); /* 用 一個 無回顯 的 字元輸入函數
來實現暫停執行,按 任意鍵
繼續的功能 */
}
}
}
int ShowMenu()
{
int cmd = 0; /* 保存用戶的選擇 */
/* 定義 程序所支持的菜單項目 */
char Menu_SeeData[] = "\t1 .\tView the Records in the data file\n"; /* 查看數據文件
*/
char Menu_Add[] = "\t2 .\tAdd New Record\n"; /* 添加記錄 */
char Menu_Delete[] = "\t3 .\tDelete an old Record\n"; /* 刪除記錄 */
char Menu_Statistics[] = "\t4 .\tMake a Statistics\n"; /* 統計分析 */
char Menu_Find_ID[] = "\t5 .\tFind a Record from the ID\n"; /* 按
學號(ID)
查找 */
char Menu_Find_Name[] = "\t6 .\tFind a Record from the Name\n"; /* 按
姓名(Name)
查找 */
char Menu_Quit[] = "\t7 .\tQuit\n"; /* 退出 */
/* 在屏幕上列印 主菜單 */
printf("\n\n############ Main Menu ###############\n");
printf("##############################################\n\n");
printf(Menu_SeeData);
printf(Menu_Add);
printf(Menu_Delete);
printf(Menu_Statistics);
printf(Menu_Find_ID);
printf(Menu_Find_Name);
printf(Menu_Quit);
printf("\n##############################################");
printf("\n\n Input the index of your choice : ");
scanf("%d", &cmd); /* 接受用戶 選擇 */
printf("\n");
return cmd; /* 返回用戶的輸入,交給主循環處理
*/
}
void Print() /* 列印 數據文件的 記錄內容 */
{
FILE *fp = NULL; /* 文件指針 */
Student rec; /* 存放從文件中讀取的記錄 */
int i = 0; /* 實現 計數 和 分屏列印的功能 */
fp = fopen(DATA_FILE, "rb"); /* 以 二進制讀 方式
打開數據文件 */
if (fp == NULL) /* 打開文件出錯 */
{
printf(" Can not open the data file : %s\n", DATA_FILE);
return;
}
while (ReadData(fp, &rec)) /* ReadData()
函數出錯或到文件末尾時返回
0,可以做循環條件 */
{
Output_Rec(&rec); /* 正確讀取,將記錄輸出 */
printf(" ------------------------------------------");
/* 列印一行分隔符,營造好的用戶界面 */
i ; /* 計數器 加一 */
if (i % 4 == 0) /* 顯示 4 個暫停一下 */
{
printf("\n Press any key to continue ... \n");
getch();
}
}
printf("\n The current data file have\t%d\trecord .\n", i);
fclose(fp); /* 關閉文件 */
}
void Add() /* 添加記錄 */
{
Student rec;
FILE *fp = NULL;
Input_Rec(&rec); /* 讓用戶輸入新記錄的各項內容 */
fp = fopen(DATA_FILE, "ab"); /* 以 添加 方式打開數據文件 */
if (fp == NULL)
{
printf(" Can not open the data file to write into ... \n");
return;
}
if (WriteData(fp, &rec) == 1) /* 將 新記錄 寫入文件,並檢查
是否正確寫入 */
printf("\n\n Add New Record Success \n\n");
else
printf("\n\n Failed to Write New Record into the data file \n");
fclose(fp);
}
void Delete() /* 刪除記錄 */
{
Student rec;
FILE *fpr, *fpw; /* 兩個文件指針,分別用於 讀 和
寫 */
char buf[30]; /* 接受 用戶輸入的 ID 緩沖區 */
char cmd[255]; /* 執行的系統命令 */
int del_count; /* 實際 刪除的 記錄數目 */
del_count = 0;
printf("\n Please type the ID of the record you want me to delete .");
printf("\n The ID : "); /* 提示用戶 輸入 */
scanf("%s", buf);
fpr = fopen(DATA_FILE, "rb"); /* 從
原來的記錄文件中讀取數據,跳過將要刪除的記錄
*/
if (fpr == NULL)
{
printf(" Can not open the data file to read record ... \n");
return;
}
fpw = fopen(TEMP_FILE, "wb"); /* 打開一個 臨時文件
保存不刪除的記錄 */
if (fpw == NULL)
{
printf(" Can not open the data file to write into ... \n");
return;
}
while (ReadData(fpr, &rec)) /* 讀取 要保留的記錄 */
{
if (strcmp(rec.ID, buf) != 0)
{
WriteData(fpw, &rec); /* 寫入臨時文件 ,然後刪除
原數據文件,
再將臨時文件該名為原數據文件的名字
*/
}
else
{
del_count ; /* 跳過的記錄數目,即刪除的數目 */
}
}
fclose(fpr);
fclose(fpw);
strcpy(cmd, "del "); /* 構造命令串,用 system() 函數執行
*/
strcat(cmd, DATA_FILE);
system(cmd);
rename(TEMP_FILE, DATA_FILE); /* 直接調用 C
語言的改名函數將臨時文件改名為數據文件的名字
*/
printf("\n I have delete\t%d\trecord .\n", del_count);
}
void Statistics() /* 統計分析函數 */
{
int i50, i60, i70, i80, i90; /* 平均分小於60
,60-69,70-79,80-89,>=90
的分數段的學生數目 */
float avg; /* 平均分 */
int sum, sum_high, sum_low; /* 總分,總分最高分,總分最低分 */
Student stu_high, stu_low; /* 總分最高和最低 學生的信息 */
Student stu_math_high, stu_english_high; /* 各科
最高分的學生記錄副本
*/
Student stu_compute_high, stu_philosophy_high, stu_PE_high;
Student stu_math_low, stu_english_low; /* 各科最低的學生記錄副本
*/
Student stu_compute_low, stu_philosophy_low, stu_PE_low;
FILE *fp;
Student rec;
int count; /* 一個計數器,用於判斷是否第一次讀取數據
*/
count = sum = sum_high = sum_low = i50 = i60 = i60 = i70 = i80 = i90 = 0;
fp = NULL; /* 對 數據初始化 */
fp = fopen(DATA_FILE, "rb");
if (fp == NULL)
{
printf("\nCan not open the data file to read ...\n");
return;
}
while (ReadData(fp, &rec)) /* 讀取數據 */
{
count ; /* 計數器 加一 */
sum = rec.Math rec.English rec.Compute rec.PE rec.Philosophy; /* 求和
*/
/* average */
avg = ((float)sum) / 5; /* 平均分 */
/* 下面對各個分數段進行統計 */
if (avg < 60)
i50 ;
else if (avg < 70)
i60 ;
else if (avg < 80)
i70 ;
else if (avg < 90)
i80 ;
else
i90 ;
/* highest and loeest */
if (count <= 1) /* 第一次讀取,執行初始化,不進行比較
*/
{
sum_high = sum_low = sum;
CopyRec(&stu_high, &rec);
CopyRec(&stu_low, &rec);
}
else
{
if (sum > sum_high)
{
sum_high = sum; /* 得到最高總分 */
CopyRec(&stu_high, &rec); /* 保存總分最高的學生的信息
*/
}
if (sum < sum_low)
{
sum_low = sum; /* 得到最低分 */
CopyRec(&stu_low, &rec); /* 保存總分最低的學生的信息
*/
}
}
/* subject highest and low */
if (count == 1) /* 同上面一樣,執行初始化 */
{
CopyRec(&stu_math_high, &rec);
CopyRec(&stu_english_high, &rec);
CopyRec(&stu_compute_high, &rec);
CopyRec(&stu_philosophy_high, &rec);
CopyRec(&stu_PE_high, &rec);
CopyRec(&stu_math_low, &rec);
CopyRec(&stu_english_low, &rec);
CopyRec(&stu_compute_low, &rec);
CopyRec(&stu_philosophy_low, &rec);
CopyRec(&stu_PE_low, &rec);
}
else
{
/* High */
/* 保存各科的最高分的學生的信息 */
if (rec.Math > stu_math_high.Math)
CopyRec(&stu_math_high, &rec);
if (rec.English > stu_english_high.English)
CopyRec(&stu_english_high, &rec);
if (rec.Compute > stu_compute_high.Compute)
CopyRec(&stu_compute_high, &rec);
if (rec.Philosophy > stu_philosophy_high.Philosophy)
CopyRec(&stu_philosophy_high, &rec);
if (rec.PE > stu_PE_high.PE)
CopyRec(&stu_PE_high, &rec);
/* low */
/* 保存各科的最低分的學生的信息 */
if (rec.Math < stu_math_low.Math)
CopyRec(&stu_math_low, &rec);
if (rec.English < stu_english_low.English)
CopyRec(&stu_english_low, &rec);
if (rec.Compute < stu_compute_low.Compute)
CopyRec(&stu_compute_low, &rec);
if (rec.Philosophy < stu_philosophy_low.Philosophy)
CopyRec(&stu_philosophy_low, &rec);
if (rec.PE < stu_PE_low.PE)
CopyRec(&stu_PE_low, &rec);
}
} /* While End */
if (count < 1)
{
printf("\n There is no record in the data file .\n");
}
else
{
/* average */
/* 輸出平均分的分段統計信息 */
printf("\n The count in each segment :\n");
printf("\t < 60\t:\t%d\n", i50);
printf("\t60 - 69\t:\t%d\n", i60);
printf("\t70 - 79\t:\t%d\n", i70);
printf("\t80 - 90\t:\t%d\n", i80);
printf("\t >= 90\t:\t%d\n", i90);
printf(" ------------------------------------------");
getch();
/* highest and loeest */
/* 輸出總分最高的學生的信息 */
printf("\n The Highest Mark Student:\n");
printf(" The Mark is : %d\n", sum_high);
printf(" The student is :\n");
Output_Rec(&stu_high);
/* 輸出總分最高的學生的信息 */
printf("\n The Lowest Mark Student:\n");
printf(" The Mark is : %d\n", sum_low);
printf(" The student is :\n");
Output_Rec(&stu_low);
printf(" ------------------------------------------\n");
getch();
/* subject highest and low */
/* 輸出各科最高和最低分的統計信息 */
printf(" The Highest\tMath :\n");
Output_Rec(&stu_math_high);
printf(" The Lowest Math :\n");
Output_Rec(&stu_math_low);
printf(" ------------------------------------------\n");
getch(); /* 暫停 ,按任意鍵繼續 */
printf(" The Highest English :\n");
Output_Rec(&stu_english_high);
printf(" The Lowest English :\n");
Output_Rec(&stu_english_low);
printf(" ------------------------------------------\n");
getch();
printf(" The Highest Compute :\n");
Output_Rec(&stu_compute_high);
printf(" The Lowest Compute :\n");
Output_Rec(&stu_compute_low);
printf(" ------------------------------------------\n");
getch();
printf(" The Highest Philosophy :\n");
Output_Rec(&stu_philosophy_high);
printf(" The Lowest Philosophy :\n");
Output_Rec(&stu_philosophy_low);
printf(" ------------------------------------------\n");
getch();
printf(" The Highest PE :\n");
Output_Rec(&stu_PE_high);
printf(" The Lowest PE :\n");
Output_Rec(&stu_PE_low);
printf(" ------------------------------------------\n");
}
fclose(fp);
}
void Find(int isFind_From_ID) /* 查找函數 */
{
char buf[30]; /* 接受用戶輸入的條件的緩沖區 */
Student rec;
int find_count; /* 查找到的記錄數目 */
FILE *fp;
find_count = 0;
fp = fopen(DATA_FILE, "rb");
if (fp == NULL)
{
printf("\n Can not open the data file to search ...\n");
return;
}
switch (isFind_From_ID)
{
case 5: /* ID,按 學號查找 */
printf("\n Please Input the ID : ");
scanf("%s", buf); /* 提示用戶輸入 */
while (ReadData(fp, &rec)) /* 讀取數據 */
{
if (strcmp(rec.ID, buf) == 0) /* 比較 */
{
find_count ;
Output_Rec(&rec); /* 輸出符合條件的記錄 */
printf(" ------------------------------------------\n");
}
}
break;
case 6: /* Name ,按 姓名 查找 */
printf("\n Please Input the Name : ");
scanf("%s", buf);
while (ReadData(fp, &rec))
{
if (strcmp(rec.Name, buf) == 0)
{
find_count ;
Output_Rec(&rec);
printf(" ------------------------------------------\n");
}
}
break;
default:
printf(" \nPlease type right index ...\n"); /* 處理isFind_From_ID既不是5也不是6的情況
*/
}
if (find_count > 0) /* 輸出找到的記錄數目 */
{
printf("\n Have find out\t%d\trecord\n", find_count);
}
else
{
printf
("\n I'm very sorry .\n I failed to find out the one you want .\n");
printf("\n I suggest that you change some other key words .\n");
}
fclose(fp);
}
int ReadData(FILE * fp, Student * Dest_Rec) /* 讀取數據記錄 */
{
int r;
if ((fp == NULL) || (Dest_Rec == NULL))
return 0; /* ERROR */
r = fread(Dest_Rec, sizeof(Student), 1, fp);
if (r != 1)
return 0;
return 1;
}
int WriteData(FILE * fp, Student * Src_Rec) /* 寫入數據記錄 */
{
int r;
if ((fp == NULL) || (Src_Rec == NULL))
return 0; /* ERROR */
r = fwrite(Src_Rec, sizeof(Student), 1, fp);
if (r != 1)
return 0;
return 1;
}
void Output_Rec(Student * stu) /* 在屏幕上輸出 一個學生的信息 */
{
printf("\n");
printf(" Name : %s", stu->Name);
printf("\t\tSex : ");
if (stu->Sex == 'M' || stu->Sex == 'm')
printf("Male");
else
printf("Female");
printf("\n ID : %s\t\tClass : %s\n", stu->ID, stu->Class);
printf("Math = %d\tEnglish = %d\tCompute = %d\n", stu->Math, stu->English,
stu->Compute);
printf("Philosophy = %d\t\tPE = %d\n", stu->Philosophy, stu->PE);
printf("\n");
}
void Input_Rec(Student * stu) /* 讓用戶輸入 一個學生的各項信息
*/
{
if (stu == NULL)
return;
printf("\n Name = ");
scanf("%s", stu->Name);
/* 下面這段代碼實現只能輸入 F ,f ,M ,m 的功能 */
printf("\tSex = (F|M) ");
while (1)
{
stu->Sex = getch(); /* 無回顯輸入 */
if (stu->Sex == 'F' || stu->Sex == 'f' || stu->Sex == 'M'
|| stu->Sex == 'm')
{
printf("%c", stu->Sex); /* 將用戶輸入的字元輸出,模擬正常輸入數據時的回顯
*/
break;
}
}
/* 下面 給出提示,讓用戶輸入結構體的各項內容 */
printf("\n ID = ");
scanf("%s", stu->ID);
printf("\n Class = ");
scanf("%s", stu->Class);
printf("\n Math = ");
scanf("%d", &(stu->Math));
printf("\n English = ");
scanf("%d", &(stu->English));
printf("\n Compute = ");
scanf("%d", &(stu->Compute));
printf("\n Philosophy = ");
scanf("%d", &(stu->Philosophy));
printf("\n PE = ");
scanf("%d", &(stu->PE));
printf("\n");
}
/* 因為結構體不能直接用 等號(=)賦值,寫一個賦值函數 */
void CopyRec(Student * dest_stu, Student * src_stu)
{
/* 復制 源記錄 的各項到 目標記錄 */
strcpy(dest_stu->Name, src_stu->Name);
strcpy(dest_stu->ID, src_stu->ID);
strcpy(dest_stu->Class, src_stu->Class);
dest_stu->Sex = src_stu->Sex;
dest_stu->Math = src_stu->Math;
dest_stu->English = src_stu->English;
dest_stu->Compute = src_stu->Compute;
dest_stu->Philosophy = src_stu->Philosophy;
dest_stu->PE = src_stu->PE;
}
/*
題目分析 及 演算法設計 :
題目中的各個功能都是相對獨立的,所以我將各項功能以
帶 編號 的菜單形式組織在屏幕上,用戶通過 輸入 編號
執行相應的功能。顯示菜單的代碼處於一個循環之中,當執行完一個子功能後,就又回到循環,顯示主菜單,直到用戶選擇
退出 菜單。 這種操作方式比其它機制(如:主程序
程序參數)更簡捷,不必每次用不同的參數重新運行程序,以實現相應的功能。
1. 查看文件記錄內容的實現: 用循環讀取文件內容,然後顯示在屏幕上。
因為我們的數據是以結構體的形式存放在文件中的,所以
代碼中用了塊讀取和塊寫入函數。 在循環中設置計數器來統計記錄的個數。 2.
添加記錄的實現:
讓用戶根據屏幕提示輸入數據,完成對學生信息結構體各項的賦值,待取得足夠數據後,將數據文件以「追加」方式打開,執行塊寫入,將整個結構體寫入文件。
3. 刪除記錄的實現:
學號(ID)一般不會重復,所以我在程序中讓用戶輸入想要刪除的記錄的學號(ID),然後在文件中查找,如果不是用戶想要刪除的記錄(即ID不同),就保存在一個臨時的文件中,這樣,就將想要刪除的記錄與其它記錄分離開了,最後,刪除原來的數據文件,將臨時文件的名字改為
原來數據文件的名字。 4. 統計功能的實現:
統計功能模塊分為三個小模塊:平均分的分數段統計,總分的最高和最低分統計,各科的最高和最低分統計。但我並不想分別來寫,因為它們都要對所有記錄進行掃描,而它們又互不幹擾,所以我把它們組織在一個循環中,各自都有自己的計算代碼和變數,所以這個
函數 中的局部變數 很多。 5. 查找功能的實現: 題目要求兩種查找方式:按 學號(ID) , 按 姓名(Name)。 兩者是獨立的,所以我用了一個參數 isFind_From_ID
來表明是哪種查找方式,進而在在程序內部由一個 switch() 選擇分支轉向不同的代碼段去執行。
具體的查找就是比較相應的項目是否與用戶輸入的一樣,若一樣就輸出到屏幕。 */
❼ 學生成績管理系統課程設計
你好,我曾用c++學生成績管理系統的程序,希望能對你有所幫助。
#include <string.h>
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
/*------------------------------------定義類部分------------------------------------------------*/
class Node
{
char name[10];
int score;
class Node *next;
public:
Node* CreateNode(int n);
void PrinfListNode(Node *h);
void InsertList(Node *h,int i,char name[],int e,int *n);
void DeleteList(Node *h,int i,int *n);
Node* operator +=(Node *p);
Node *Unique(Node *p,int *n);
};
void DisplayNote(void);
/*--------------------建立單鏈表的成員函數,單鏈表節點的個數不確定--------------------------------*/
Node *Node::CreateNode(int n)
{
Node *head;
Node *pre,*p;
int i;
head=(Node*)malloc(sizeof(Node)); //用malloc動態申請內存,個數作為函數的輸入參數
head->next=NULL;
pre=head;
for (i=1;i<=n;i++)
{
printf("請輸入學生姓名:",i);
p=(Node*)malloc(sizeof(Node));
scanf("%s",p->name);
printf("請輸入此學生的分數:",i);
scanf("%d",&p->score);
pre->next=p;
pre=p;
}
p->next=NULL;
return head;
}
/*---------------------------------輸出鏈表函數實現部分------------------------------------------*/
void Node::PrinfListNode(Node *h)
{
Node *p;
p=h->next;
while(p)
{
printf("name:%s\tscore:%d",p->name,p->score);
p=p->next;
printf("\n");
}
}
/*----------------------------實現單鏈表的插入操作的成員函數--------------------------------------*/
void Node::InsertList(Node *h,int i,char name[],int e,int *n)
{
Node *p,*q;
int j;
if (i<1||i>(*n)+1)
{
printf("出錯啦!請重試!.\n");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=(Node *)malloc(sizeof(Node));
strcpy(q->name,name);
q->score=e;
q->next=p->next;
p->next=q;
(*n)++;
}
}
/*-----------------------------實現單鏈表的刪除操作的成員函數-------------------------------------*/
void Node::DeleteList(Node *h,int i,int *n)
{
Node *p,*q;
int j;
char name[10];
int score;
if (i<1||i>(*n))
{
printf("出錯啦!請重試!.\n");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=p->next;
p->next=q->next;
strcpy(name,q->name);
score=q->score;
free(q);
(*n)--;
}
}
/*--------------------------重載運算符「+=」實現兩個鏈表對象合並功能------------------------------*/
Node *Node::operator +=(Node *p)
{
Node *q=this;
while(q->next!=NULL) //把第一個鏈表最後的next指向第二個的頭
{
q=q->next;
}
q->next=p->next;
return this;
}
/*----------------編寫Unique()成員函數,實現剔除鏈表中重復元素,使所有節點值唯-----------------*/
Node *Node::Unique(Node *p,int *n)
{ Node *q=this,*k,*m;
int i;
if((*n)<=1) //用循環,拿一個和每一個去比較,一樣的刪除使用已經寫好的刪除函數
cout<<"ERROR!"<<endl;
else
{
for(i=1;i<(*n);q=q->next)
{
k=q;
p=q->next;
while(p!=NULL)
{
if(strcmp(q->name,p->name)==0)
{
m=p;
p=p->next;
k->next=m->next;
free(m);
(*n)--;
}
else{
k=p;
p=p->next;
}
}
}
}
return this;
}
/*--------------------------------編寫主函數測試上述功能---------------------------------------*/
int main()
{
Node *h,*k;
int i=1,n,score;
char name[10];
int *m=0;
while(i)
{
DisplayNote();
scanf("%d",&i);
switch(i)
{
case 1:
printf("請輸入表中成員的個數:\n");
scanf("%d",&n);
h=h->CreateNode(n);
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 2:
printf("請寫出成員的位置:");
scanf("%d",&i);
printf("請輸入學生姓名:");
scanf("%s",&name);
printf("請輸入學生分數:");
scanf("%d",&score);
h->InsertList(h,i,name,score,&n);
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 3:
printf("請寫出成員的位置:");
scanf("%d",&i);
h->DeleteList(h,i,&n);
cout<<"表中成員為:\n";
h->PrinfListNode(h);
break;
case 4:
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 5:
printf("請輸入另一個表中成員的個數:\n");
scanf("%d",&n);
k=k->CreateNode(n);
h=h->operator +=(k);
printf("兩個鏈表相加之後的鏈表是:\n");
h->PrinfListNode(h);
break;
case 6:
h=h->Unique(h,&n);
printf("剔除重復元素後的新鏈表是:\n");
h->PrinfListNode(h);
break;
case 0:
return 0;
break;
default:
printf("出錯啦!請重試!");
}
}
return 0;
}
void DisplayNote(void)
{
printf("1--建立新的鏈表\n");
printf("2--添加元素\n");
printf("3--刪除元素\n");
printf("4--輸出當前鏈表中的內容\n");
printf("5--兩個鏈表對象合並\n");
printf("6--剔除鏈表中重復元素\n");
printf("0--退出\n");
}
❽ 我的計算機畢業設計題目是學生成績管理系統,這個系統應該包含哪些功能呢
本系統設計的是一個學生成績管理系統,主要是按照學生成績管理問題,來開發的一個小系統,目標是使學生管理的工作人員在平時的管理中也做到數據的信息化、快速化和網路化。本系統經過簡單擴充就可以成為一個完整的學生成績管理系統。下面來說一下本程序的各個模塊的功能。本程序由登錄界面、主窗口、用戶管理、學生檔案管理模塊、班級管理模塊、課程管理模塊、成績管理模塊等部分組成。 http://www.lw777.net/a/jisuanji/vb/2010/1010/265.html你到三七論文網參考一下,裡面有很多資料可以學習。
❾ 學生成績管理系統課程設計.
#include <iostream>#include <stdio.h>#include <string.h>#include <conio.h>#include <iostream>#include <ctime>using namespace std;#define max 100
//////////////////////////////////////////////////////////////////////////strcut stustruct stu //學生資料結構體{ char name[10]; char num[20]; //學號 char adress[8]; float x,y,z,score; int number;};
//////////////////////////////////////////////////////////////////////////////student.cppint count=0;int temp=0;int Exchang=0; //定義數據修改標志,若修改則為1,否則為0class student //學生類{private: stu data[max]; char start_del;public: void input(char *ch1,char *num,char *ch2,float x,float y,float z); //輸入 void find(char *num); //查找 void del(char *num); //刪除 int check_num(char *num) //確定沒有重復學號 { int m=0; while(m<=count) if(!strcmp(num,data[m++].num)) //判斷是否相同 break; if(m>count) return 0; else return 1; } void taxis(); //總分排序 void show(); void save(); //保存學生資料 void read(); //從文件"student"讀取學生資料};
void student::input(char *ch1,char *num,char *ch2,float x,float y,float z){ strcpy(data[count].name,ch1); strcpy(data[count].num,num); strcpy(data[count].adress,ch2); data[count].x=x; data[count].y=y; data[count].z=z; count++; Exchang=1; //設置已修改數據標志}void student::find(char * num){ int m=0; while(m<=count) if(!strcmp(num,data[m++].num)) break; if(m>count) { cout << "很抱歉,沒有該學號的學生" << endl; start_del='n'; getch(); } else { temp=count; count=m; start_del='y'; cout << "該學生的資料為" <<endl << "序號\t姓名\t學號\t\t地址\t\t\t高數\t英語\t計算機" << endl; show(); count=temp; getch(); }}void student::del(char *num){ char chose; find(num); if(start_del=='y') {
cout << "確實要刪除該學生資料? Y/N" << endl; cin >> chose; if(chose=='y') { int m=0; while(m<count) if(strcmp(num,data[m++].num)==0) //錯在這里 break; temp=count; count=m; if(temp==count) { count=temp-1;printf("2"); cout << "該學生資料已刪除" << endl; Exchang=1; //設置已修改數據標志 } else { while(count<temp) { strcpy(data[count-1].name,data[count].name); strcpy(data[count-1].num,data[count].num); strcpy(data[count-1].adress,data[count].adress); data[count-1].x=data[count].x; data[count-1].y=data[count].y; data[count-1].z=data[count].z; count++;
}printf("1"); count=temp-1; cout << "該學生資料已刪除" << endl; Exchang=1; //設置已修改數據標志 } } else cout << "學生資料未刪除" << endl; getch();
}}void student::taxis(){ int x,y,array[max]; int change; for(x=0;x<count;x++) array[x]=data[x].score=data[x].x+data[x].y+data[x].z; for(x=0;x<count-1;x++) for(y=0;y<count-1-x;y++) if(array[y]<array[y+1]) { change=array[y]; array[y]=array[y+1]; array[y+1]=change; } cout << "總分\t姓名\t學號\t\t地址\t\t高數\t英語\t計算機" << endl; for(x=0;x<count;x++) for(y=0;y<count;y++) if(array[x]==data[y].score) { cout << data[y].score << "\t" << data[y].name << "\t" << data[y].num << "\t" << data[y].adress << "\t" << data[y].x << "\t" << data[y].y << "\t" << data[y].z << endl; } getch(); Exchang=1; //設置已修改數據標志}
void student::show(){ cout << count << "\t" << data[count-1].name << "\t" << data[count-1].num << "\t" << data[count-1].adress << "\t\t" << data[count-1].x << "\t" << data[count-1].y << "\t" << data[count-1].z << endl;}
//////////////////////////////////////////////////////////////////////main.cppvoid main(){ student st; char *ch1,*ch2,chose; char flag[2],num[20],find[20],del[20]; char ch;
float x,y,z; time_t t; time(&t);
while(1) { system("cls"); cout << "------------------------學生管理系統------------------------" <<endl
<< " 1.輸入/添加學生資料 "<<endl << " 2.輸出學生資料" <<endl << " 3.查找 " <<endl << " 4.刪除" <<endl << " 5.總分排序" <<endl << " 6.退出" << endl << endl << " 請選擇你要的服務(1-6)" << endl; cin >> chose; if(chose=='6') { break; } switch(chose) { case '1': // 輸入學生信息 { do { cout << "請輸入學生姓名:" << endl; ch1=new char[]; ch2=new char[]; cin >> ch1 ; cout << "請輸入學號:" << endl; cin >> num ; while(st.check_num(num)) { cout << "學號重復,請重新輸入" << endl; cin >> num; } cout << "請輸入地址:"<<endl; cin >> ch2 ; cout << "請輸入高數成績:"<<endl; cin >> x; cout << "請輸入英語成績:" <<endl; cin >> y; cout << "請輸入計算機成績:" <<endl; cin >> z; st.input(ch1,num,ch2,x,y,z); printf("\n是否繼續輸入學生信息?(\"y\"繼續)"); scanf("%s", flag); }while(strcmp(flag, "y") == 0); }break; case '2':// 輸出學生資料 { temp=count; count=1; cout << "序號\t姓名\t學號\t\t地址\t\t\t高數\t英語\t計算機" << endl; while(count<=temp) { st.show(); count++; } count--; getch(); }break; case '3': { cout << "請輸入你要查找學生的學號" << endl; cin >> find; st.find(find); }break; case '4': { cout << "請輸入你要刪除的學生學號" << endl; cin >> del; st.del(del); }break; case '5': { st.taxis(); }break;
default: { cout << "輸入錯誤!!!,請重新輸入" << endl; getch(); } } } cout << "感謝你的使用!\n" <<endl; getch();
}