#include<conio.h>
#include<iostream.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
#include<stdio.h>
#define PIXEL_COUNT 1000
#define DELAY_TIME 100
int color=RED;
void start_graphics()
{
int gdriver = DETECT, gmode, errorcode;
int i, x, y, color, maxx, maxy,
maxcolor, seed;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
cout<<"Graphics error: ", grapherrormsg(errorcode);
cout<<"Press any key to halt:";
getch();
exit(1);
}
}
void dda(int x1,int y1,int x2,int y2)
{
int x,y;
x=x1;
y=y1;
float dx=x2-x1;
float dy=y2-y1;
float m=dy/dx;
putpixel(x,round(y),color);
for(int i=x1;i<x2;i++)
{
x++;
y=y+m;
putpixel(x,round(y+0.5),color);
}
}
void main()
{
clrscr();
start_graphics();
int x1,y1,x2,y2;
int a1,b1,c1,d1;
cout<<"Nhap toa do A: ";
cin>>x1>>y1;
cout<<"Nhap toa do B: ";
cin>>x2>>y2;
cout<<"Nhap toa do C: ";
cin>>a1>>b1;
setcolor(RED);
line(x1,y1,x2,y2);
line(x2,y2,a1,b1);
line(a1,b1,x1,y1);
getch();
closegraph();
}
Code báo lỗi: Function 'round' should have a prototype
Mong mọi ngưởi giúp đỡ
Bookmarks