c++大作業--学籍管理システム--
13782 ワード
1.テーマ描写叙述
学籍管理システム:情報管理システムの業務プロセス、要求及び実現する目標に基づいて、以下の機能を完成する:(1)学生ファイルの管理とメンテナンスを確立する.コンピュータの自己アクティブ化管理体制を実現する.(2)学生成績管理メカニズムを確立し、コンピュータのサポートの下で高速に学生成績の照会と変更を完了する.(3)カリキュラム設定管理を確立し、コンピュータのサポートの下でカリキュラムの加入、変更を実現する.(4)クラス設定管理を確立し、コンピュータのサポートの下でクラスの加入、削除と変更を実現する.(5)システムの権限設定管理を実現し、システムの安全性を保証する.(登録パスワードエラー3回登録不可)
(6)氏名学号を用いて学生情報を検索する.
(7)学生情報をファイルに保存する.2.考え方を分析する
クラスを用いて学生情報を格納し,学生情報の管理変更を実現する.
3.入力:
1,passwordの設定入力およびログイン入力.
2、機能選択の入力.
3,学生情報入力
4.出力:
1,学生情報の出力.
2,学生情報のファイル格納.
5.プログラムコード:
6.プログラム実行結果のスクリーンショット
反復授業は選択に同意しない.
学生情報をファイルに保存できます
名前と学号で学生情報を調べることができます
成績の入力と変更を実現できる
学籍管理システム:情報管理システムの業務プロセス、要求及び実現する目標に基づいて、以下の機能を完成する:(1)学生ファイルの管理とメンテナンスを確立する.コンピュータの自己アクティブ化管理体制を実現する.(2)学生成績管理メカニズムを確立し、コンピュータのサポートの下で高速に学生成績の照会と変更を完了する.(3)カリキュラム設定管理を確立し、コンピュータのサポートの下でカリキュラムの加入、変更を実現する.(4)クラス設定管理を確立し、コンピュータのサポートの下でクラスの加入、削除と変更を実現する.(5)システムの権限設定管理を実現し、システムの安全性を保証する.(登録パスワードエラー3回登録不可)
(6)氏名学号を用いて学生情報を検索する.
(7)学生情報をファイルに保存する.2.考え方を分析する
クラスを用いて学生情報を格納し,学生情報の管理変更を実現する.
3.入力:
1,passwordの設定入力およびログイン入力.
2、機能選択の入力.
3,学生情報入力
void sr() //////
{
cout<<" ";
cin>>xm;
cout<<" ";
time.shuru();
ll=shurupanduan(time.year,time.month,time.day);
if(ll==0)
time.shuru();
cout<<" ";
cin>>bj;
cout<<" (5 ) ";
for(int i=0;i<5;i++)
{
cin>>kc[i];
for(intj=0;j<i;j++)
{
while(kc[i]==kc[j])
{
cout<<" "<<endl;
cin>>kc[i];
}
}
}
4.出力:
1,学生情報の出力.
2,学生情報のファイル格納.
5.プログラムコード:
#include<iostream>
#include <string>
#include<conio.h>
#include<iomanip>
#include<time.h>
# include<fstream>
void bangzhu();
void bcxx(int);
void dqsj();
bool pdxhcf(int,int);
int shurupanduan(int,int,int);
int runnian(int );
using namespace std;
struct sj
{
intyear,month,day; ////////
void shuru()
{cin>>year>>month>>day;
}
};
class student ////////////
{
public :
string xm,kc[5];
int bj,xh,cj[5],ll;
sj time;
voidsrxhh()
{
cout<<" ";
cin>>xh;
}
void sr() //////
{
cout<<" ";
cin>>xm;
cout<<" ";
time.shuru();
ll=shurupanduan(time.year,time.month,time.day);
if(ll==0)
time.shuru();
cout<<" ";
cin>>bj;
cout<<" (5 ) ";
for(int i=0;i<5;i++)
{
cin>>kc[i];
for(intj=0;j<i;j++)
{
while(kc[i]==kc[j])
{
cout<<" "<<endl;
cin>>kc[i];
}
}
}
system("cls");
}
void chengji() ///////
{
int i;
for(i=0;i<5;i++)
{
cout<<" "<<kc[i]<<" "<<endl;
cin>>cj[i];
}
}
void chengjisc() ///////
{
inti;
for(i=0;i<5;i++)
{
cout<<kc[i]<<" ";
cout<<cj[i]<<' ';
}
}
};
void cxkb(student t)
{
intn;
cout<<" 1, 0"<<endl;
cin>>n;
if(n==1)
for(int i=0;i<5;i++)
cout<<t.kc[i]<<' ';
}
string mima() //////// password
{
cout<<"**************************** *********************************"<<endl;
dqsj();
cout<<" password:";
string mm1,mm2;
char ch;
while ((ch=_getch())!=13)
{
mm1+=ch;
cout<<"*";
}
cout<<endl;
cout<<" password:";
while ((ch=_getch())!=13)
{
mm2+=ch;
cout<<"*";
}
system("cls");
if(mm1==mm2)
return mm1;
else
mima();
}
int denglu(string mm) /////////
{
cout<<"**************************** *********************************"<<endl;
dqsj();
cout<<" password:";
string mm1,mm2,mm3;
char ch;
while ((ch=_getch())!=13)
{
mm1+=ch;
cout<<"*";
}
system("cls");
cout<<"**************************** *********************************"<<endl;
dqsj();
if(mm==mm1)
return 1;
else
{
cout<<"password , , ";
while ((ch=_getch())!=13)
{
mm2+=ch;
cout<<"*";
}
system("cls");
if(mm==mm2)
return 1;
else
{
cout<<"password , , ";
while ((ch=_getch())!=13)
{
mm3+=ch;
cout<<"*";
}
system("cls");
if(mm==mm3)
return 1;
else
{
cout<<"password , ";
return 0;
}
}
}
}
student chazhaoxg(student t) //
{cout<<" 1, 2, 3."<<endl;
cout<<" 4, 5";
int a,i;
string xk;
cin>>a;
switch(a)
{
case 1:cin>>t.xm;break;
case2:cin>>t.time.year>>t.time.month>>t.time.day;break;
case 3:cin>>t.bj;break;
case 4:for(i=0;i<5;i++)cin>>t.kc[i];break;
case 5:
cout<<" "<<endl;
cin>>xk;for(i=0;i<5;i++)
{
if(t.kc[i]==xk)
{cout<<" "<<endl;
cin>>t.kc[i];
}
}break;
}
return t;
}
void shuchuxinxi(student t) //
{
cout<<t.xh<<' '<<t.xm<<''<<t.time.year<<t.time.month<<t.time.day<<t.bj<<'';
}
student stu[500];
int main() //// ..................
{
intn=0,i,xh;
string mm,xm; //password
mm=mima(); //password
i=denglu(mm);
if(i)
{
int a;
system("cls");
while(1)
{
cout<<"**************************** *********************************"<<endl;
dqsj();
bangzhu();
cin>>a;
system("cls");
cout<<"**************************** *********************************"<<endl;
dqsj();
if(a==0)
break;
else
{
switch(a)
{
case1:
stu[n].srxhh();
while(!pdxhcf(n,stu[n].xh))
{
cout<<" "<<endl;
stu[n].srxhh();
}
stu[n].sr(),n++;
break;
case 2:
for(i=0;i<n;i++)
{
cout<<stu[i].xh<<'';
cout<<stu[i].xm<<endl;
}
break;
case 3:
cout<<" ";
cin>>xh;
for(i=0;i<n;i++)
if(stu[i].xh==xh)
stu[i]=chazhaoxg(stu[i]);break;
case 6:
cout<<" ";
cin>>xh;
for(i=0;i<n;i++)
if(stu[i].xh==xh)
stu[i].chengji();break;
case7:
cout<<" ";
cin>>xh;
for(i=0;i<n;i++)
if(stu[i].xh==xh)
stu[i].chengjisc();
break;
case4:
cout<<" ";
cin>>xh;
for(i=0;i<n;i++)
if(stu[i].xh==xh)
{
shuchuxinxi(stu[i]);
cxkb(stu[i]);
}break;
case5:
cout<<" ";
cin>>xm;
for(i=0;i<n;i++)
if(stu[i].xm==xm)
{shuchuxinxi(stu[i]);
cxkb(stu[i]);
}break;
case 9:bangzhu();break;
case8:bcxx(n);break;
}
}
}
}
return 0;
}
void bangzhu() //
{ cout<<" "<<endl<<endl;
cout<<" 1. � ";
cout<<" 2. "<<endl;
cout<<"============================";
cout<<"============================"<<endl;
cout<<" 3. ";
cout<<" 4, "<<endl;
cout<<"============================";
cout<<"============================"<<endl;
cout<<" 5, " ;
cout<<" 6, "<<endl;
cout<<"============================";
cout<<"============================"<<endl;
cout<<" 7, ";
cout<<" 8, "<<endl;
cout<<"============================";
cout<<"============================"<<endl;
cout<<" 9. ";
cout<<" 0. "<<endl ;
cout<<"============================";
cout<<"============================"<<endl;
}
int shurupanduan(int a,int b,int c=1) //
{int l=1,q,ll;
if(a<=0||b<=0||b>12||c<0)
{l=0;
cout<<" "<<endl;}
switch(b)
{
case 1:q=31;break;
case 2:q=28;break;
case 3:q=31;break;
case 5:q=31;break;
case 7:q=31;break;
case 8:q=31;break;
case 10:q=31;break;
case 12:q=31;break;
case 4:q=30;break;
case 6:q=30;break;
case 9:q=30;break;
case 11:q=30;break;
}
ll=runnian(a);
if(ll)
q++;
if(c>q)
{
l=0;
cout<<" "<<endl;}
return l;
}
int runnian(int a) //
{
intl=0;
if((a%4==0&&a%100!=0)||(a%400==0))
l=1;
return l;
}
void bcxx(int n)
{
cout<<" :";
char s[20];
cin>>s;
ofstream outfile(s,ios::out);
inti=0;
studentt;
outfile<<" "<<" "<<" "<<" "<<endl;
for(i=0;i<n;i++)
{
t=stu[i];
outfile<<fixed<<setw(12)<<t.xh<<''<<fixed<<setw(6)<<t.xm<<' '
<<fixed<<setw(7)<<t.time.year<<t.time.month<<t.time.day<<""
<<fixed<<setw(4)<<t.bj<<'';
}
}
void dqsj() //
{
time_t t = time(NULL);
struct tm *local = localtime(&t);
int year = local -> tm_year + 1900;
int month = local -> tm_mon + 1;
int day = local -> tm_mday;
int hour = local -> tm_hour;
int minute = local -> tm_min;
int second = local -> tm_sec;
cout <<" : "<<" "<<year<<" "<<month<<" "<<day<<" "<<'';
cout <<endl<<" "<<hour<<":"<<minute<<":"<<second<<endl<<endl;
}
bool pdxhcf(int n,int a)//
{
booll=1;
inti;
for(i=0;i<n;i++)
{
if(a==stu[i].xh)
{
l=0;
break;
}
}
returnl;
}
6.プログラム実行結果のスクリーンショット
反復授業は選択に同意しない.
学生情報をファイルに保存できます
名前と学号で学生情報を調べることができます
成績の入力と変更を実現できる