#include<easyx.h>//图形界面库
#include<stdio.h>
int main()
{
initgraph(800,600);//创建一个窗口,宽度为800,高度为600
setorigin(400, 300);//以物理坐标为基准设置逻辑坐标的原点
setaspectratio(1, -1);//实现坐标轴的翻转,-1把y轴翻转
int x, y;
for (int i = 0; i < 1000; i++)
{
x = rand() % (800 + 1) - 400;//x的取值范围为-400~400
y = rand() % (600 + 1) - 300;//y的取值范围为-300~300
putpixel(x, y, RED);//红色的点
}
getchar();//暂时阻塞程序,等待用户按键关闭
closegraph();//关闭绘图窗体函数
return 0;
}
绘制1000个红色的点。