C语言画点问题

来源:百度知道 编辑:UC知道 时间:2024/05/29 18:47:56
背景为黑色,在(x,y)对应的像素点上(x,y都是整数)画一个白点,程序应该怎样写?(不知道我这样的问法有没错误)
麻烦写写完整的源代码。
谢谢大家了!!

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int driver=DETECT, mode, x ,y;
printf("Please input x, y!\nx: ");
scanf("%d",&x);
printf("y: ");
scanf("%d", &y);
initgraph(&driver, &mode, "");//进入图形界面
setbkcolor(0);//设置背景色

putpixel(x, y, 15);//画点,要注意看,很小
getch();//暂停,否则看不见了
}

#include<graphics.h>
#include<stdlib.h>
void main()
{ int driver=VGA,mode=VGAHI,x,y;
initgraph(&driver,&mode,"");
do{x=random(639);
y=random(459);
putpixel(x,y,15);
delay(80000);
}while(1);
}

把delay去掉看看效果