ndp1007
18-02-2009, 05:50
Code này khi chạy VS C++ thì báo lỗi
"Cannot open include file: 'graphics.h': No such file or directory"
là sao vậy các bạn
Vậy để tạo file Graphic.h thì phải làm sao và để nó ở đâu.
#include <graphics.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
int maxx = getmaxx(), maxy = getmaxy();
char msg[] = "Hello !";
int msgwidth = textwidth(msg);
int msgheight = textheight(msg);
int x = maxx + msgwidth;
int y = (maxy - msgheight) / 2;
int dx = 5;
char ch = 0;
do
{
setfillstyle(SOLID_FILL,0);
bar(x, y, x + dx + msgwidth, y + msgheight);
outtextxy(x, y, msg);
x -= dx;
if (x < -(dx + msgwidth))
{
x = maxx + msgwidth;
}
if (kbhit())
{
ch = getch();
}
delay(200);
}
while (ch != 27);
closegraph();
return 0;
}
"Cannot open include file: 'graphics.h': No such file or directory"
là sao vậy các bạn
Vậy để tạo file Graphic.h thì phải làm sao và để nó ở đâu.
#include <graphics.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
int maxx = getmaxx(), maxy = getmaxy();
char msg[] = "Hello !";
int msgwidth = textwidth(msg);
int msgheight = textheight(msg);
int x = maxx + msgwidth;
int y = (maxy - msgheight) / 2;
int dx = 5;
char ch = 0;
do
{
setfillstyle(SOLID_FILL,0);
bar(x, y, x + dx + msgwidth, y + msgheight);
outtextxy(x, y, msg);
x -= dx;
if (x < -(dx + msgwidth))
{
x = maxx + msgwidth;
}
if (kbhit())
{
ch = getch();
}
delay(200);
}
while (ch != 27);
closegraph();
return 0;
}