计算机实习内容要求.docx
- 文档编号:11082034
- 上传时间:2023-05-29
- 格式:DOCX
- 页数:34
- 大小:121.44KB
计算机实习内容要求.docx
《计算机实习内容要求.docx》由会员分享,可在线阅读,更多相关《计算机实习内容要求.docx(34页珍藏版)》请在冰点文库上搜索。
计算机实习内容要求
计算机实习内容要求
*
北京邮电大学信息与通信工程学院
计算机实习内容要求
信息与通信工程学院2010级
2011年8月22日
实习要求
1基本要求
1.1、内容要求
作品的内容可以是下面4种中的任意一种:
Ø可以制作一个小游戏,比如俄罗斯方块、贪吃蛇、时钟、投筛子等;
Ø可以制作一个课件,比如模拟汉诺塔游戏的过程;
Ø可以制作一个管理系统,比如学生成绩管理、学生基本信息管理等;
Ø其它你认为有兴趣的作品。
1.2、作品功能要求
基本要求:
Ø能够应用文件流进行磁盘文件的读写:
比如游戏分数的保存等
Ø能够应用面向对象的设计思想和方法
Ø能够使用多文件结构
Ø能够播放音频文件,增强游戏的效果
2可选课题
鉴于部分同学对于Windows编程非常感兴趣,并且C++基础较好,可以1-2人组成一个课题小组,尝试完成下面的课题(选作可选课题中的任何一个,就不需要在做基本要求中的内容了)。
同学们分组作自选课题必须跟老师协商并说明思路,经老师允许后方可开始进行。
2.1、完成一个简单计算器
简单计算器的界面如图3所示,功能可以参见Windows操作系统的附件中的计算器的功能,能够完成基本的算术运算。
图1简单计算器
研究步骤:
1)学习Windows编程框架,了解消息机制
2)学习各种控件的使用,尤其是对话框、按钮、编辑框等
3)学习菜单的使用
图3简单学生管理系统
研究步骤:
1)学习Windows编程框架,了解消息机制
2)学习各种控件的使用,尤其是对话框、按钮、编辑框等
3)学习菜单的使用
4)学习IO流的使用
5)可以对各种信息进行管理,比如学生成绩管理系统、通讯录、图书管理系统等
2.3、完成一个画图软件
简单的画图软件的形式和功能可以参考Windows操作系统中“附件”里的画图软件,如图6所示。
图4画图软件
该软件能够完成如下基本功能:
(1)能够绘制直线、曲线;
(2)能够绘制各种形状,比如矩形、椭圆形等
(3)能够绘制各种实心形状,比如实心矩形、实心椭圆等
(4)能够添加文字
(5)能够设置不同的绘制颜色
研究步骤:
1)学习使用单文档的(Singledocument)程序结构
2)学习使用MFC中CDC类系列的使用,包括CPen类、CBrush类等
3)学习使用鼠标消息处理函数的使用
4)有能力的同学可以扩展画图软件的功能,比如能够显示磁盘上已有的图片文件、能够具备“橡皮擦”的功能,进行擦除、能够保存绘制后的图形等等
2.4、自选题目
学生根据自身的情况,可以自由选择感兴趣的题目,要求一要写出具体的想法以及预期完成的结果,二要征得实验教师的同意。
下面给出一些题目可供参考。
1)可以实现一个简单的Windows游戏,比如:
碰碰球游戏,游戏者可以控制木板的左右移动,迎接下落的小球,小球与模板碰撞后弹起,反复运行,直到小球下落后木板无法接起,游戏结束。
参考程序如图7所示。
图6碰碰球游戏
2)可以实现Josephus问题的求解,Josephus问题是:
n个小孩围成一圈,任意假定一个数m,从第一个小孩起,顺时针方向数,每数到第m个的小孩时,该小孩便离开。
小孩不断离开,圈子中的人数不断减少,最后一个离开的小孩是胜利者,请问最后一个离开的小孩的编号?
实现可参考程序如图8所示。
图7Josephus问题的求解
3)可以学习使用OpenGL等工具库实现一个动画制作,题目任意。
4)可以学习数据库的使用,完成一个基于数据库的信息管理系统。
5)可以学习Socket类的使用,完成一个基于网络的应用,比如一个即时消息系统、文件传输系统等。
6)可以学习如何实现一个屏幕保护程序
7)可以学习任何你感兴趣的相关程序设计的知识,完成一个完整的作品。
参考资料
可以参考以下资料。
1)vc经典教程.chm电子版
2)C++到VisualC++6.0精彩100例,应甫臣、刘迎辉编,《电脑爱好者杂志出版社》,2001年
3)VisualC++课程设计案例精选,严华峰等编著,《中国水利水电出版社》,2002年
附件1
文件ColorConsole.h
#include
#include
usingnamespacestd;
HANDLEinitiate();
BOOLtextout(HANDLEhOutput,intx,inty,WORDwColors[],intnColors,LPTSTRlpszString);
附件2
文件colorConsole.cpp
#include"colorConsole.h"
HANDLEinitiate()
{
HANDLEhOutput;
hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
returnhOutput;
}
BOOLtextout(HANDLEhOutput,intx,inty,WORDwColors[],intnColors,LPTSTRlpszString)
{
DWORDcWritten;
BOOLfSuccess;
COORDcoord;
coord.X=x;//startatfirstcell
coord.Y=y;//offirstrow
fSuccess=WriteConsoleOutputCharacter(
hOutput,//screenbufferhandle
lpszString,//pointertosourcestring
lstrlen(lpszString),//lengthofstring
coord,//firstcelltowriteto
&cWritten);//actualnumberwritten
if(!
fSuccess)
cout<<"error:
WriteConsoleOutputCharacter"< for(;fSuccess&&coord.X { fSuccess=WriteConsoleOutputAttribute( hOutput,//screenbufferhandle wColors,//pointertosourcestring nColors,//lengthofstring coord,//firstcelltowriteto &cWritten);//actualnumberwritten } if(! fSuccess) cout<<"error: WriteConsoleOutputAttribute"< return0; } 附件3 主文件main.cpp #include #include #include #include"colorConsole.h" //投筛子 voidrolldice(HANDLEhOutput,intn,intcol,introw,WORDwColors[]); voidmain(void) { HANDLEhandle; WORDwColors[1]; introw,col; //初始化 handle=initiate(); //生成6个不同骰子 wColors[0]=FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY; row=col=2; for(inti=0;i<6;i++) rolldice(handle,i+1,col,row+6*i,wColors); //打印屏幕底部菜单 WORDwMenuColors[1]; wMenuColors[0]=FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_INTENSITY; textout(handle,1,24,wMenuColors,1,"游戏规则: "); textout(handle,11,24,wMenuColors,1,"投掷开始/结束=ENTER;"); textout(handle,34,24,wMenuColors,1,"更换游戏者=空格;"); textout(handle,53,24,wMenuColors,1,"退出=q."); boolflag=false; intcount=1; intsum=0; //随机数的种子 srand((unsigned)time(NULL)); col=15; row=8; //游戏开始 while (1) { if(_kbhit()) { intch=_getch(); if(ch==13) { flag=! flag; if(! flag) { wColors[0]=FOREGROUND_RED|FOREGROUND_INTENSITY; rolldice(handle,i+1,row,col,wColors); //记录游戏者和点数 charbuf[20]; itoa(count,buf,10); textout(handle,1,13+2*count,wMenuColors,1,buf); textout(handle,3,13+2*count,wMenuColors,1,"点数: "); sum+=i+1; itoa(sum,buf,10); textout(handle,9,13+2*count,wMenuColors,1,buf); } } elseif(ch==32)//更换游戏者 { sum=0; count++; } elseif(ch=='q'||ch=='Q') break; } if(flag)//随机投筛子 { i=rand()%6; wColors[0]=FOREGROUND_RED|FOREGROUND_INTENSITY; rolldice(handle,i+1,row,col,wColors); Sleep(100); wColors[0]=0; rolldice(handle,i+1,row,col,wColors); } } } voidrolldice(HANDLEhOutput,intn,intcol,introw,WORDwColors[]) { switch(n){ case1: textout(hOutput,row+1,col+1,wColors,1,"●"); break; case2: textout(hOutput,row+1,col,wColors,1,"●"); textout(hOutput,row+1,col+2,wColors,1,"●"); break; case3: textout(hOutput,row,col+2,wColors,1,"●"); textout(hOutput,row+1,col+1,wColors,1,"●"); textout(hOutput,row+2,col,wColors,1,"●"); break; case4: textout(hOutput,row,col,wColors,1,"●"); textout(hOutput,row,col+2,wColors,1,"●"); textout(hOutput,row+2,col,wColors,1,"●"); textout(hOutput,row+2,col+2,wColors,1,"●"); break;; case5: textout(hOutput,row,col,wColors,1,"●"); textout(hOutput,row,col+2,wColors,1,"●"); textout(hOutput,row+1,col+1,wColors,1,"●"); textout(hOutput,row+2,col,wColors,1,"●"); textout(hOutput,row+2,col+2,wColors,1,"●"); break; case6: textout(hOutput,row,col,wColors,1,"●"); textout(hOutput,row,col+1,wColors,1,"●"); textout(hOutput,row,col+2,wColors,1,"●"); textout(hOutput,row+2,col,wColors,1,"●"); textout(hOutput,row+2,col+1,wColors,1,"●"); textout(hOutput,row+2,col+2,wColors,1,"●"); break; default: cout<<"投掷骰子失败! "< } }■ #include #include #include #include #include"colorConsole.h" HANDLEinitiate(); voidmain(void) { HANDLEhandle; handle=initiate(); WORDwColors[2]; wColors[0]=FOREGROUND_RED| FOREGROUND_INTENSITY; wColors[1]=FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; inty=20,x=7; while(x<80) { inti=_getch(); if(i=='w') {textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y--; textout(handle,x,y,wColors,1,"■"); } if(i=='s') {textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y++; textout(handle,x,y,wColors,1,"■");} if(i=='d') { textout(handle,x,y,wColors,1,"■"); x++;} if(i=='a') { textout(handle,x,y,wColors,1,"■"); x--;} }}※ #include #include #include #include #include"colorConsole.h" HANDLEinitiate(); voidmain(void) { HANDLEhandle; handle=initiate(); WORDwColors[1]; wColors[0]=FOREGROUND_RED| FOREGROUND_INTENSITY; //wColors[1]=FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; WORDwbackColors[1]; wbackColors[0]=FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; for(intj=5;j<15;j++) {textout(handle,5,j,wbackColors,1,"■");} for(inti=5;i<15;i++) {textout(handle,25,i,wbackColors,1,"■");} inty=6,x=7; while(x<25) { inti=_getch(); if(i=='w') {textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y--; textout(handle,x,y,wColors,1,"■"); } if(i=='s') {textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y++; textout(handle,x,y,wColors,1,"■");} if(i=='d') { textout(handle,x,y,wColors,1,"■"); x++;} if(i=='a') { textout(handle,x,y,wColors,1,"■"); x--;} }} #include #include #include #include #include"colorConsole.h" HANDLEinitiate(); voidmain(void) { HANDLEhandle; handle=initiate(); WORDwColors[1]; wColors[0]=FOREGROUND_RED| FOREGROUND_INTENSITY; //wColors[1]=FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; WORDwbackColors[1]; wbackColors[0]=FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; for(intj=5;j<15;j++) {textout(handle,5,j,wbackColors,1,"■");} for(inti=5;i<15;i++) {textout(handle,25,i,wbackColors,1,"■");} inty=6,x=7;intm=10,n=10; textout(handle,m,n,wColors,1,"●"); while(x<25&&m<25) { inti=_getch(); //if(x==m&&y==n) if(i=='w') {if(y==n+2&&x==m) {textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); Sleep(100); textout(handle,x,y,wColors,1,""); textout(handle,m,n,wColors,1,""); y--; n--; textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); } else {textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y--; textout(handle,x,y,wColors,1,"■"); }} if(i=='s') {if(y==n-2&&x==m) {textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); Sleep(100); textout(handle,x,y,wColors,1,""); textout(handle,m,n,wColors,1,""); y++; n++; textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); } else{ textout(handle,x,y,wColors,1,"■"); Sleep(100); textout(handle,x,y,wColors,1,""); y++; textout(handle,x,y,wColors,1,"■");}} if(i=='d') {if(x=m-2) {textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); x++; m++;} else{textout(handle,x,y,wColors,1,"■"); x++; }} if(i=='a') {if(x==m+2) {textout(handle,x,y,wColors,1,"■"); textout(handle,m,n,wColors,1,"●"); x--; m--;} else{ textout(handle,x,y,wColors,1,"■"); x--;}} }} #include #include #include #include
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 实习 内容 要求