logo资料库

面向对象程序设计.doc

第1页 / 共9页
第2页 / 共9页
第3页 / 共9页
第4页 / 共9页
第5页 / 共9页
第6页 / 共9页
第7页 / 共9页
第8页 / 共9页
资料共9页,剩余部分请下载后查看
一.实验题目:面向对象程序设计选题系统
课程设计报告 课程设计题目:面向对象程序设计 学生姓名:徐立华 专 班 业:软件 级:5 班 指导教师:魏振华 2013 年 6 月 27 日
一.实验题目:面向对象程序设计选题系统 二.实验要求: 以班级为单位进行选题,题目信息以文件形式存放,包括:编号、题目、任务要求、完 成时间等。 (1)学生信息包括:学号、姓名、班级; (2)输入学号,随机抽取题目,限定每个题目只能被一个学生选中; (3)选题结果以文件形式存放,可以随时进行查询操作。 三.结论 自己还有一些不懂,还要进一部加强。
四.代码过程 #include #include using namespace std; class students { private: char xh; char name[20]; int bj; public: students() {} { } void set() cin>>xh>>name>>bj; char getxh() { } return xh; /* char getname()
{ return name; }*/ int getbj() { } return bj; }; struct xtm { int bh; char tm[50]; char ru[200]; char sj[50]; }; int main() { ofstream out("D:\\test"); if(!out) { cout<<"cannot open file"; return 1;
} out<<1<>i;*/ cout<<"******************* 请 输 入 学 生 信 息 ******************"<
int j; for(j=0;j<3;j++) stu[j].set(); ifstream in("D:\\test"); if(!in) { } cout<<"cannot open file"; return 1; xtm tp[3]; int k; for(k=0;k<3;k++) in>>tp[k].bh>>tp[k].tm>>tp[k].ru>>tp[k].sj; in.close(); int h,w,p; ofstream out2("D:\\text"); if(!out2) { } cout<<"cannot open file"; return 1; for(w=0;w<3;w++)
{ cout<<"输入学号:"; cin>>h; cout<<"输入题号:"; cin>>p; cout<<" 学 号 :"<
分享到:
收藏