主要實現以下功能:
1、新增學生;
2、查詢學生;
3、刪除學生;
4、修改學生;
5、重新排序;
6、顯示全部;
7、退出。
c++**:
#include
#include
#include
#include
//用到system()
#include
using
namespace std;
const
short max_size =50;
class
student
;//分號加與不加均可通過編譯
student
(char
*n)student
(char
*n,char
*i)void
setmath
(float m)
void
setenglish
(float e)
void
setcomputer
(float c)
void
setname
(char
*n) string getname()
string getid()
float
getsum()
void
setallscore
(float m,
float e,
float c)
bool
match
(char
*str,
short flag)
float
getmath()
float
getenglish()
float
getcomputer()
void
print()
private
:char name[12]
;char id[10]
;float math;
float english;
float computer;};
bool
compare1
(student stu1, student stu2)
bool
compare2
(student stu1, student stu2)
class
database
bool
push
(char
*n,char
*i,float m,
float e,
float c)
student st
(n, i)
; st.
setallscore
(m, e, c)
; stu[size++
]= st;
return
true;}
bool
push()
char n[12]
, i[10]
; cout <<
"please input name:"
; cin >> n;
int idx;do}
}while
(idx < size)
; student stu_tmp
(n, i)
;float m, e, c;
cout <<
"please input math score:"
; cin >> m;
cout <<
"please input english score:"
; cin >> e;
cout <<
"please input computer score:"
; cin >> c;
stu_tmp.
setallscore
(m, e, c)
; stu[size]
= stu_tmp;
size++
; cout <<
"新增成功!"
<< endl;
system
("pause");
return
true;}
short
aimedsearch
(short start_id,
char
*str,
short flag)
}return-1
;//未找到
}short
search()
while
(choice !=
1&& choice !=2)
;char match[12]
; cout <<
"請輸入你要找的"
<<
(choice ==1?
"姓名:"
:"學號:");
cin >> match;
short result =0;
char nod;
while
(true
) cout <<
"這是你要找的人嗎?(y/n)"
; cin >> nod;
if(nod ==
'y'|| nod ==
'y')
return result;
else
result++;}
}bool
delete()
size--
; cout <<
"刪除成功!"
<< endl;
system
("pause");
return
true;}
else
}bool
alter()
cout <<
"是否要進行修改?(y/n)"
<< endl;
cin >> nod;
if(nod ==
'y'|| nod ==
'y')
return
true;}
cout <<
"未修改!"
<< endl;
system
("pause");
return
false;}
void
display()
cout <<
resetiosflags
(ios::left)
;system
("pause");
}void
sort()
while
(choice !=
'1'&&choice !=
'2');if
(choice ==
'1')
else
cout <<
"排序完成!"
<< endl;
system
("pause");
}char
showmenu()
while
(choice <
'1'&& choice>
'7')
;return choice;
}private
: student stu[max_size]
;short size;};
intmain()
}return0;
}
c++執行結果: 學生成績管理系統
include include include define n 50 定義符號常量,代表學生人數最大值 int count 0 全域性變數,用於記錄陣列的當前位置 struct student 定義結構體型別,代表學生資訊 void input struct student arr 函式宣告,輸入...
學生成績管理系統
include include include include include include include include define null 0 define esc 0x001b 退出 define f1 0x3b00 檢視幫助資訊,呼叫helpmassage 函式 define f2 ...
學生成績管理系統
這是進入大學以來,第一次做的c語言課程設計,覺得挺有意義,把 貼上來,曬一下!學生成績管理系統 教師,管理員密碼 輸入學生的基本資訊 輸出學生的基本資訊 查詢學生的基本資訊 學生成績分析 排序 統計 退出 include include include include include include...