C语言学习知识程序设计论文资料及其说明.doc
《C语言学习知识程序设计论文资料及其说明.doc》由会员分享,可在线阅读,更多相关《C语言学习知识程序设计论文资料及其说明.doc(13页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、C语言程序设计论文学校:天津电子信息职业技术学院系别:电子技术系专业:通信技术班级:通信S13-26学号:89757姓名:王磊C语言课程设计报告一、 设计题目:计算器二、 设计目标:进一步加深、巩固学生所学专业课程(C语言)的基本理论知识,理论联系实际,进一步培养学生综合分析问题和解决问题的能力。掌握运用C语言独立地编写、调试应用程序和进行其它相关设计的技能,充分发挥广大同学的潜力,使他们通过本次课程设计而得到全面的锻炼。三、 设计内容:1.设计系统的功能框图、流程图;2.编写计算器的源程序代码;3.上机调试;4.答辩;5.书写实习报告。四、 课程设计所用设备:每人一台计算机。五、 课程设计系
2、统组成及模块功能: (1) 主函数模块(2) 设置系统进入图形模块(3) 初始化图形系统模块(4) 计算器计算函数模块(5) 窗口函数模块(6) 设计鼠标图形函数模块(7) 获取特殊键函数模块 六、软件环境:Visual c+6.0七、 课程设计要求:在计算机上操作,通过Visual c+6.0,设计出“计算器”程序。八、 应提交的材料:实习报告一份,内容包含“计算器”程序代码。设计报告:程序代码:#include #include #include #include #include #include #include #include #include #define UP 0x48 #d
3、efine DOWN 0x50 #define LEFT 0x4b #define RIGHT 0x4d #define ENTER 0x0d void *rar; struct palettetype palette; int GraphDriver;int GraphMode;int ErrorCode;int MaxColors;int MaxX, MaxY;double AspectRatio;void drawboder(void); void initialize(void); void computer(void); void changetextstyle(int font,
4、int direction, int charsize); void mwindow(char *header); int specialkey(void) ; int arrow(); int main() initialize(); computer(); closegraph(); return(0); void initialize(void) int xasp, yasp; GraphDriver = DETECT; initgraph( &GraphDriver, &GraphMode, );ErrorCode = graphresult(); if( ErrorCode != g
5、rOk ) printf(Graphics System Error: %sn, grapherrormsg( ErrorCode ) ); exit( 1 ); getpalette( &palette ); MaxColors = getmaxcolor() + 1; MaxX = getmaxx(); MaxY = getmaxy(); getaspectratio( &xasp, &yasp ); AspectRatio = (double)xasp/(double)yasp;void computer(void) struct viewporttype vp; int color,
6、height, width; int x, y,x0,y0, i, j,v,m,n,act,flag=1; float num1=0,num2=0,result; char cnum5,str220=,c,temp20=; char str1=1230.456+-789*/Qc=%; mwindow( Calculator ); color = 7; getviewsettings( &vp ); width=(vp.right+1)/10; height=(vp.bottom-10)/10 ; x = width /2; y = height/2; setfillstyle(SOLID_FI
7、LL, color+3); bar( x+width*2, y, x+7*width, y+height ); setcolor( color+3 ); rectangle( x+width*2, y, x+7*width, y+height ); setcolor(RED); outtextxy(x+3*width,y+height/2,0.); x =2*width-width/2; y =2*height+height/2; for( j=0 ; j4 ; +j ) for( i=0 ; i=x0+6*width) x=x0; m=0; else x=x+width+width/2; m
8、+; if(v=LEFT) if(x=x0) x=x0+6*width; m=4; else x=x-width-width/2;m-; if(v=UP) if(y=7*height) y=y0; n=0; else y=y+height+height/2;n+; putimage(x,y,rar,XOR_PUT); c=str1n*5+m; if(isdigit(c)|c=.) if(flag=-1) strcpy(str2,-); flag=1; sprintf(temp,%c,c); strcat(str2,temp); setfillstyle(SOLID_FILL,color+3);
9、 bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,str2); if(c=+) num1=atof(str2); strcpy(str2,); act=1; setfillstyle(SOLID_FILL,color+3); bar(2*width+width/2,height/2,15*width/2,3*height/2); outtextxy(5*width,height,0.); if(c=-) if(strcmp(str2,)=0) flag=-1; else num1=ato
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 学习 知识 程序设计 论文 资料 及其 说明
限制150内