//*** ***** ***** ***** ***** ***** ***** ***** ***** ***** // //学生成绩管理系统 2010 . /JXN // //** ***** ***** ***** ***** ***** ***** ***** ***** ***** *// # inclu de<io strea m> #i nclud e<fst ream> #inc lude< strin g> #i nclud e<iom anip> usin g nam espac e std ;c lass Stude nt //** ***** ***** ***** ***** ***** 学生类{ priv ate: intn um; int age; cha rpho [50]; ch ar ad d[100 ]; char name[ 20]; cha r sex [4]; cha r bir [40]; publ ic: inpu t(); del et(); lo ok(); fi nd(); ch ange( ); appen d(); };S tuden t x[5 0]; St udent ::inp ut() //***** ***** ***** ***** ***** **输入{ loo p: int num, a=0,t ; fo r(int s=0; s<=50 ;s++) { co ut<<" 请输入学号(大于等于 1000 的四位数): "<<en dl; cin>> num; i fstre am fi le("a t",io s::bi nary) ; //以二进制打开文件 fi ekg(0 ,ios: :beg) ; for( inti =0;i< 50;i+ +) { file. read( (char *)&x [i],s izeof (x[i] ));//读取文件 if(nu m==x[ i].nu m)a=1 ; if (x[i] .num= =0){t =i;i= 50;} //t记录 i值, "i=50 "跳出循环} if (a==1 ||num <1000 ||num >9999 ){ cou t<<" 您输入的学号不合规则或已存在! " <<end l; go to loop; } el sex [t].n um=nu m; cout< <"请输入姓名: "< <endl ; ci n>>x[ t].na me; co ut<<" 请输入性别(男或女): "<<e ndl; cin >>x[t ].sex ; co ut<<" 请输入年龄: "<<e ndl; cin> >x[t] .age; cout< <"请输入生日(年/月/日): "<<en dl; cin>> x[t]. bir; cout <<" 请输入电话: " <<end l; c in>>x [t].p ho; cout< <"请输入地址: "< <endl ; ci n>>x[ t].ad d; s =50; //" s=50" 跳出循环} ofs tream file ("aaa .txt" );f or(in t i=0 ;i<10 ;i++) {fi it
c学生信息管理系统 来自淘豆网www.taodocs.com转载请标明出处.