zasto mi compiler izbacuje: fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
Error executing cl.exe.
za ovaj kod:
Code:
#include <conio.h>
#include<graphics.h> //OVDE je error, zasto?
#include <stdio.h>
#include<process.h>
#include<dos.h>
static int mx,my,click;
union REGS regs,regs1;
void intro();
void getmouse();
void mousepos();
void points();
void main(void)
{
int a=DETECT,b,c,x,y,x1,y1,s=50,x2=200,y2=300,p=0,p1=0;
initgraph(&a,&b,"");
x=x1=getmaxx()/2;
y=y1=getmaxy()/2;
settextstyle(3,0,6);
outtextxy(330,40,"RULES");
settextstyle(3,1,2);
outtextxy(10,100,"PLAYER 2 PLAYER 1");
settextstyle(1,0,1);
outtextxy(40,120,"Keyboard player should touch the big circle of mouse");
settextstyle(1,0,1);
outtextxy(40,140,"and should escape from the small cirle of the mouse ");
settextstyle(1,0,1);
outtextxy(40,160,"player using arrows ");
settextstyle(1,0,1);
outtextxy(40,280,"Mouse player should touch the keyboard circle with the ");
settextstyle(1,0,1);
outtextxy(40,300,"small circle above the screen using left click, right click");
settextstyle(1,0,1);
outtextxy(40,320,"and both clicks to bring the circle down saving the big circle ");
getch();
cleardevice();
settextstyle(2,0,6);
outtextxy(200,100,"target score 200");
getch();
for(;;)
{
getmouse();
mousepos();
circle(x2,y2,20);
while(kbhit())
c=getch();
cleardevice();
setcolor(2);
circle(x,y,40);
setlinestyle(1,2,3);
setcolor(2);
line(x1,y1,x,y);
setcolor(14);
gotoxy(3,30);
printf("points of keyboard player are %d points of mouse player 1 are %d",p,p1);
setlinestyle(5,6,70);
rectangle(20,20,getmaxx()-20,getmaxy()-20);
circle(mx,my,65);
if(p1>=200)
{
clearviewport();
settextstyle(1,0,5);
outtextxy(100,200,"mouse player wins");
delay(2000);
getch();
exit(2);
}
if(p>=200)
{
cleardevice();
settextstyle(1,0,5);
outtextxy(100,200,"keyboard player wins");
delay(2000);
getch();
exit(2);
}
if(mx<x+105&&mx>x-105&&my<y+105&&my>y-105)
{
p+=10;
delay(500);
points();
}
if(x2<x+45&&x2>x-45&&y2<y+45&&y2>y-45)
{
p1+=10;
delay(500);
points();
}
if(c==77) //>
{
if(x<getmaxx()-90)
x+=s;
}
if(c==72) //^
{
if(y>90)
y-=s;
}
if(c==75) //<
{
if(x>80)
x-=s;
}
if(c==80) //v
{
if(y<getmaxy()-90)
y+=s;
}
if(c==77&&c==80) // > v
{
if(x<getmaxy()-40)
x+=s;
if(y<getmaxy()-40)
y+=s;
}
if(c==72&&c==75) //^ <
{
if(y>40)
y-=s;
if(x>40)
x-=s;
}
if(c==75&&c==80) //< v
{
if(x>40)
x-=s;
if(y<getmaxy()-40)
y+=s;
}
if(c==80&&c==75) //v <
{
if(y<getmaxy()-40)
y+=s;
if(x>20)
x-=s;
}
if(click==2) //> right
{
if(x2<getmaxx()-40)
x2+=s;
}
if(click==0) //^ no click
{
if(y2>40)
y2-=s;
}
if(click==1) //< left
{
if(x2>40)
x2-=s;
}
if(click==3) //v both
{
if(y2<getmaxy()-40)
y2+=s;
}
}
}
void getmouse()
{
int86(51,®s,®s1);
regs.x.ax=1;
}
void mousepos()
{
regs.x.ax=3;
int86(51,®s,®s1);
click=regs1.x.bx;
mx=regs1.x.cx;
my=regs1.x.dx;
}
void points()
{
settextstyle(3,0,12);
outtextxy(100,200,"+ 10");
}
#include <conio.h>
#include<graphics.h> //OVDE je error, zasto?
#include <stdio.h>
#include<process.h>
#include<dos.h>
static int mx,my,click;
union REGS regs,regs1;
void intro();
void getmouse();
void mousepos();
void points();
void main(void)
{
int a=DETECT,b,c,x,y,x1,y1,s=50,x2=200,y2=300,p=0,p1=0;
initgraph(&a,&b,"");
x=x1=getmaxx()/2;
y=y1=getmaxy()/2;
settextstyle(3,0,6);
outtextxy(330,40,"RULES");
settextstyle(3,1,2);
outtextxy(10,100,"PLAYER 2 PLAYER 1");
settextstyle(1,0,1);
outtextxy(40,120,"Keyboard player should touch the big circle of mouse");
settextstyle(1,0,1);
outtextxy(40,140,"and should escape from the small cirle of the mouse ");
settextstyle(1,0,1);
outtextxy(40,160,"player using arrows ");
settextstyle(1,0,1);
outtextxy(40,280,"Mouse player should touch the keyboard circle with the ");
settextstyle(1,0,1);
outtextxy(40,300,"small circle above the screen using left click, right click");
settextstyle(1,0,1);
outtextxy(40,320,"and both clicks to bring the circle down saving the big circle ");
getch();
cleardevice();
settextstyle(2,0,6);
outtextxy(200,100,"target score 200");
getch();
for(;;)
{
getmouse();
mousepos();
circle(x2,y2,20);
while(kbhit())
c=getch();
cleardevice();
setcolor(2);
circle(x,y,40);
setlinestyle(1,2,3);
setcolor(2);
line(x1,y1,x,y);
setcolor(14);
gotoxy(3,30);
printf("points of keyboard player are %d points of mouse player 1 are %d",p,p1);
setlinestyle(5,6,70);
rectangle(20,20,getmaxx()-20,getmaxy()-20);
circle(mx,my,65);
if(p1>=200)
{
clearviewport();
settextstyle(1,0,5);
outtextxy(100,200,"mouse player wins");
delay(2000);
getch();
exit(2);
}
if(p>=200)
{
cleardevice();
settextstyle(1,0,5);
outtextxy(100,200,"keyboard player wins");
delay(2000);
getch();
exit(2);
}
if(mx<x+105&&mx>x-105&&my<y+105&&my>y-105)
{
p+=10;
delay(500);
points();
}
if(x2<x+45&&x2>x-45&&y2<y+45&&y2>y-45)
{
p1+=10;
delay(500);
points();
}
if(c==77) //>
{
if(x<getmaxx()-90)
x+=s;
}
if(c==72) //^
{
if(y>90)
y-=s;
}
if(c==75) //<
{
if(x>80)
x-=s;
}
if(c==80) //v
{
if(y<getmaxy()-90)
y+=s;
}
if(c==77&&c==80) // > v
{
if(x<getmaxy()-40)
x+=s;
if(y<getmaxy()-40)
y+=s;
}
if(c==72&&c==75) //^ <
{
if(y>40)
y-=s;
if(x>40)
x-=s;
}
if(c==75&&c==80) //< v
{
if(x>40)
x-=s;
if(y<getmaxy()-40)
y+=s;
}
if(c==80&&c==75) //v <
{
if(y<getmaxy()-40)
y+=s;
if(x>20)
x-=s;
}
if(click==2) //> right
{
if(x2<getmaxx()-40)
x2+=s;
}
if(click==0) //^ no click
{
if(y2>40)
y2-=s;
}
if(click==1) //< left
{
if(x2>40)
x2-=s;
}
if(click==3) //v both
{
if(y2<getmaxy()-40)
y2+=s;
}
}
}
void getmouse()
{
int86(51,®s,®s1);
regs.x.ax=1;
}
void mousepos()
{
regs.x.ax=3;
int86(51,®s,®s1);
click=regs1.x.bx;
mx=regs1.x.cx;
my=regs1.x.dx;
}
void points()
{
settextstyle(3,0,12);
outtextxy(100,200,"+ 10");
}