+ 1

whats the error..?

DX Ball Program in C++. #include<stdio.h> #include<conio.h> #include<dos.h> #include<graphics.h> #include<dos.h> #include<mouse.h> #include<string.h> int x,y,a,b,i,area,px,py,stat,bx=20,by=200,bxspeed=2,byspeed=2,scr=0; static int sq[15][15]; char *paddal,*ball,dir[3]="br",score[4]="ss"; void main() { char*img1,*img2; int gd=DETECT,gm; initgraph(&gd,&gm,"c:\tc\bgi"); x=getmaxx()/2,y=getmaxy()/2; backfrm(); splace_form(); initmouse(); while(1) { getmousepos(&stat ,&px ,&py); delay(11); if(stat==1) break; } mainfrm(); backfrm(); dpaddal(); backfrm(); dball(); backfrm(); lavel(1); printlevel(); restrictmouseptr(16,500,540,500); while(!kbhit()) { delay(10); movepaddal(); moveball(); } getch(); } //---------------------move ball---------------/// moveball() { setfillstyle(SOLID_FILL,1); bar(bx-2,by-2,bx+12,by+12); putimage(bx,by,ball,COPY_PUT); balldir(); if(!strcmp(dir,"bl")) bx-=bxspeed,by+=byspeed; if(!strcmp(dir,"br")) bx+=bxspeed,by+=byspeed; if(!strcmp(dir,"tl")) bx-=bxspeed,by-=byspeed; if(!strcmp(dir,"tr")) bx+=bxspeed,by-=byspeed; } //-----------------------ball diraction---------------// balldir() { if(!strcmp(dir,"bl") && by>440) btp("tl"); if(!strcmp(dir,"br") && by>440) btp("tr"); if(!strcmp(dir,"tl") && by<122&&sq[(by-55)/15][(bx-16)/50]==0) bts("bl"); if(!strcmp(dir,"tr") && by<122&&sq[(by-55)/15][(bx-16)/50]==0) bts("br"); if(!strcmp(dir,"bl") && by<122&&sq[(by-55)/15][(bx-16)/50]==0) bts("tl"); if(!strcmp(dir,"br") && by<122&&sq[(by-55)/15][(bx-16)/50]==0) bts("tr"); if(!strcmp(dir,"tr") && by<40) strcpy(dir,"br"),sndplay(500); if(!strcmp(dir,"tl") && by<40) strcpy(dir,"bl"),sndplay(500); if(!strcmp(dir,"bl") && bx<20) strcpy(dir,"br"),sndplay(500); if(!strcmp(dir,"tr") && bx>600) strcpy(dir,"tl"),sndplay(500); if(!strcmp(dir,"tl") && bx<20) strcpy(dir,"tr"),sndplay(500); if(!str

27th Sep 2018, 9:44 AM
Hareth Al Waard
Hareth Al Waard - avatar
1 Antwort
+ 3
First, in sololearn, there is no designed program in C++, so there is no graphics.h header file
30th Sep 2018, 11:15 AM
ShortCode