#include <graphics.h>的解决

在学习《C语言程序设计案例教程》的时候需要使用EasyX,需要使用Visual Studio开发环境。在C程序中使用#include <graphics.h>的时候出现了如下错误:

#include "pch.h"
#include <graphics.h>	
#include <math.h>
#include <conio.h>				

int main()
{
	int x, y, r, t;

	x = y = 100;
	r = 80;
	t = (int)(sqrt(2.0)*r / 2);
	initgraph(640, 480);
	circle(x, y, r);
	rectangle(x - t, y - t, x + t, y + t);
	_getch();
	closegraph();
	return 0;
}


解决的方法是去EasyX官网下载EasyX的exe程序,点击后直接对自己使用的VC版本进行安装就行了,很简单。

运行结果如图:

原文地址:https://www.cnblogs.com/123-wind/p/14327943.html