码迷,mamicode.com
首页 > 编程语言 > 详细

C++学习笔记--Season 2

时间:2015-04-06 11:15:50      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

一个简单的EGE程序:

#include "graphics.h"     //EGE库的头文件 

int main(int argc, char** argv) {
    initgraph(320,240);     //初始化绘图窗口 

    outtextxy(20,120,"Aloha World!");
    line(10,10,300,200);
    circle(30,40,20);
    
    ege::getch();   //此处加ege::名字空间,是因为conio.h文件里面也有getch函数。避免冲突被覆盖。 
    closegraph();   //绘图结束关闭绘图窗口。 
    
    return 0;       //CPP程序不加最后的return也会返回一个整形。但是为了可读性,自己要加上。 
}

下面看看“graphics.h”头文件里面的内容。(目录:C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include --> graphics.h)

#ifndef _GRAPHICS_H_
#define _GRAPHICS_H_
/*声明必须用C++的编译器器才可以使用EGE图形库*/ #ifndef __cplusplus #error You must use C++ compiler, or you need filename with ‘.cpp‘ suffix #endif #include "ege.h" using namespace ege; #endif

 

C++学习笔记--Season 2

标签:

原文地址:http://www.cnblogs.com/netcn/p/4395593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!