資源簡(jiǎn)介
這是我做的一個(gè)簡(jiǎn)單的學(xué)分管理系統(tǒng)課程設(shè)計(jì),里面有我的實(shí)現(xiàn)代碼~ 歡迎大家下載共享!

代碼片段和文件信息
#include
#include
#include
#include
#include
struct?ScoreInfo
{
char?studentId[10]; //學(xué)號(hào)
char?studentName[9]; //學(xué)生姓名
int?classId; //班號(hào)
int?ScoreBasic; //基礎(chǔ)課
int?ScoreProfessional; //專(zhuān)業(yè)課
int?ScoreElective; //選修課
int?ScoreHumanity; //人文類(lèi)課
int?ScorePractice; //實(shí)踐性
}Scorefile[100];
int?count;
class?ScoreClass
{
private:
char?studentId[10];
char?studentName[9];
int?classId;
int?ScoreBasic;
int?ScoreProfessional;
int?ScoreElective;
int?ScoreHumanity;
int?ScorePractice;
public:
void?Input(); //功能1?添加記錄,并直接存入file.txt文件中
void?Findinfo(); ///功能2?給定學(xué)號(hào),顯示某位學(xué)生的學(xué)分完成情況
void?FindClc(); //功能3?給定某個(gè)班級(jí)的班號(hào),顯示該班所有學(xué)生學(xué)分完成情況
void?Alter(); //功能4?給定某位學(xué)生的學(xué)號(hào),修改該學(xué)生的學(xué)分信息
void?Sort_record(); //功能5按照某類(lèi)課程的學(xué)分高低進(jìn)行排序
void?ShowMenu(); //顯示菜單
void?SelectMenu();
void?PrintAll();
};
//功能1輸入
void?ScoreClass::Input()
{
ofstream?outfile;//定義文件流
outfile.open(“file.txt“ios::out|ios::app);
//輸入
cout<<“輸入學(xué)號(hào)(格式如:090803115):“;
cin>>studentId;
cout<<“輸入姓名:“;
cin>>studentName;
cout<<“輸入班號(hào)(1~3):“;
cin>>classId;
cout<<“輸入基礎(chǔ)課學(xué)分:“;
cin>>ScoreBasic;
cout<<“輸入專(zhuān)業(yè)課學(xué)分:“;
cin>>ScoreProfessional;
cout<<“輸入選修課學(xué)分:“;
cin>>ScoreElective;
cout<<“輸入人文類(lèi)學(xué)分:“;
cin>>ScoreHumanity;
cout<<“輸入實(shí)踐性課程:“;
cin>>ScorePractice;
//////寫(xiě)入文件
outfile< ScoreBasic<<“?“< <<“?“< outfile.close();
cout< }
///功能2給定學(xué)號(hào),顯示某位學(xué)生的學(xué)分完成情況
void?ScoreClass::Findinfo()
{
char?s[10];
ifstream?infile;
infile.open(“file.txt“);
cout<<“請(qǐng)輸入您要查詢(xún)的學(xué)號(hào)(格式如:090803115):“< cin>>s; //暫存學(xué)號(hào)
cout< infile>>studentId>>studentName>>classId>>
ScoreBasic>>ScoreProfessional>>ScoreElective
>>ScoreHumanity>>ScorePractice;
while(infile.good())
{
if(!strcmp(sstudentId))
{
cout< <<“基礎(chǔ)課學(xué)分:“< < < break;
}
else
infile>>studentId>>studentName>>classId>>
ScoreBasic>>ScoreProfessional>>ScoreElective
>>ScoreHumanity>>ScorePractice;
}
infile.close();
cout< }
//功能3?給定某個(gè)班級(jí)的班號(hào),顯示該班所有學(xué)生學(xué)分完成情況
void?ScoreClass::FindClc()
{
int?clc;
cout<<“請(qǐng)輸入要查詢(xún)的班號(hào)(1~3):“;
cin>>clc;
ifstream?infile;
infile.open(“file.txt“);
infile>>studentId>>studentName>>classId>>
ScoreBasic>>ScoreProfessional>>ScoreElective
>>ScoreHumanity>>ScorePractice;
while(infile.good())
{
if(classId==clc)
{
cout<<“學(xué)號(hào):“< < <
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????????110??2010-05-11?15:09??學(xué)分管理系統(tǒng)(C++課程設(shè)計(jì))\file.txt
?????文件???????8335??2010-05-11?15:14??學(xué)分管理系統(tǒng)(C++課程設(shè)計(jì))\score.cpp
?????文件?????213078??2010-05-11?15:14??學(xué)分管理系統(tǒng)(C++課程設(shè)計(jì))\score.exe
?????目錄??????????0??2010-05-13?11:57??學(xué)分管理系統(tǒng)(C++課程設(shè)計(jì))
-----------?---------??----------?-----??----
???????????????221523????????????????????4
評(píng)論
共有 條評(píng)論