C语言程序设计论文
C语言程序设计论文学校:天津电子信息职业技术学院
系别:电子技术系
专业:通信技术
班级:通信S13-26
学号:89757
姓名:王磊
C语言课程设计报告
一、设计题目:计算器
二、设计目标:进一步加深、巩固学生所学专业课程(《C语言》)的基本
理论知识,理论联系实际,进一步培养学生综合分析问题和解决问题的能力。掌握运用C语言独立地编写
、调试应用程序和进行其它相关设计的技能,充分发挥广大同学的潜力,使他们通过本次课程设计而得到全面的锻炼。
三、设计内容:
1.设计系统的功能框图、流程图;
2.编写计算器的源程序代码;
3.上机调
试;4.答辩;
5.书写实习报告。
四、课程设计所用设备:每人一台计算机。
五、课程设计系统组成及模块功能:
(1)主函数模块
(2)设置系统进入图形模块
(3)初始化图形系统模块
(4)计算器计算函数模块
(5)窗口函数模块
(6)设计鼠标图形函数模块
(7)获取特殊键函数模块
六、软件环境:Visual c++6.0
七、课程设计要求:在计算机上操作,通过Visual c++6.0,设计出“计算器”
程序。
八、应提交的材料:实习报告一份,内容包含“计算器”程序代码。
设计报告:
程序代码:#include <dos.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <graphics.h>
#include <string.h>
#include <ctype.h>
#define UP 0x48
#define 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, int direction, int charsize);
void mwindow(char *header);
int specialkey(void) ;
int arrow();
int main()
{
initialize();
computer();
closegraph();
return(0);
}
c程序设计pdf下载
void initialize(void)
{
int xasp, yasp;
GraphDriver = DETECT;
initgraph( &GraphDriver, &GraphMode, "" ); ErrorCode = graphresult();
if( ErrorCode != grOk )
{
printf("Graphics System Error: %s\n",
grapherrormsg( ErrorCode ) );
exit( 1 );
}
getpalette( &palette );
MaxColors = getmaxcolor() + 1;
MaxX = getmaxx();
MaxY = getmaxy();
getaspectratio( &xasp, &yasp );
AspectRatio = (double)xasp/(double)yasp; }
void computer(void)