1. Addition of graphics.h library
method one
First download the required files:
graphic header file solution (password: 6z3y)
1. Open the include folder first
2. Copy and paste the files into the include folder of the VS2013 installation directory as follows:
3. Open the lib2013 subfolder in the downloaded folder and select all the contents to copy, Paste into the lib folder of the VS2013 installation directory as follows:
Then we can run the "graphics.h" header file in VS2013, which has a wealth of drawing functions for us to use.
Method Two
Download an installer directly on the official website:
EasyX library
It will automatically install some of the above files after the download is complete.
Then we can run the "graphics.h" header file in VS2013.
2. Use the circle function to draw a circle
#define _CRT_SECURE_NO_DEPRECATE 0
#define _CRT_NONSTDC_NO_DEPRECATE 0
#include<stdio.h>
#include<stdlib.h>
#include <graphics.h> // 引用图形库
#include <conio.h>
void main()
{
initgraph(640, 480); // 初始化图形窗口
circle(300, 200, 60); // 画圆,圆心(100, 100),半径 60
getch(); // 按任意键继续
closegraph(); // 关闭图形界面
}