suliman
30-05-2003, 12:31 AM
شباااااب عندي مشكلة
عندي هذا الكود للــــ C++
المشكلة عندي أنه فيه جرافيكس و كل ما احاول انفذه تجيني رسالة
bgi not supported under windows
و هذا الكود
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
class ball {
protected:
double x,y;
int R,color;
public:
ball(double a,double b,int c,int d):x(a),y(b),R(c),color(d) {}
void show() {
setcolor(color);
circle((int)x,(int)y,R);
}
void hide () {
setcolor(0);
circle((int)x,(int)y,R);
}};
class Tball:public ball {
int dx,dy;
public:
Tball(double a,double b,int c,int d,int e,int f):ball(a,b,c,d),dx(e),dy(f) {}
void move() {
hide();
x+=dx;
y+=dy;
if(x<=R || x>=640-R)
dx=-dx;
if(y<=R || y>=480-R)
dy=-dy;
show();
}};
class Rball:public ball {
int xc,yc;
double theta;
public:
Rball(double a,double b,int c,int d,int e,int f,double g):ball(a,b,c,d),xc(e),yc(f),theta(g) {}
void move()
{
hide();
double xr,yr;
xr=xc+(x-xc)*cos(theta)+(y-yc)*sin(theta);
yr=yc-(x-xc)*sin(theta)+(y-yc)*cos(theta);
x=xr;
y=yr;
show();
}};
void main() {
int g=0,m;
initgraph(&g,&m,"c:\\BC5\\BGI");
Rball p(400,240,15,14,320,240,0.1);
Rball q(480,240,10,2,320,240,0.2);
Tball z(320,240,5,15,5,5);
p.show();
q.show();
z.show();
while(!kbhit())
{
setcolor(7);
circle(320,240,80);
circle(320,240,160);
delay(30);
p.move();
q.move();
z.move();
}
closegraph();
}
ياليت اللي يقدر يلاقيلي حل يقوللي اياه
عندي هذا الكود للــــ C++
المشكلة عندي أنه فيه جرافيكس و كل ما احاول انفذه تجيني رسالة
bgi not supported under windows
و هذا الكود
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
class ball {
protected:
double x,y;
int R,color;
public:
ball(double a,double b,int c,int d):x(a),y(b),R(c),color(d) {}
void show() {
setcolor(color);
circle((int)x,(int)y,R);
}
void hide () {
setcolor(0);
circle((int)x,(int)y,R);
}};
class Tball:public ball {
int dx,dy;
public:
Tball(double a,double b,int c,int d,int e,int f):ball(a,b,c,d),dx(e),dy(f) {}
void move() {
hide();
x+=dx;
y+=dy;
if(x<=R || x>=640-R)
dx=-dx;
if(y<=R || y>=480-R)
dy=-dy;
show();
}};
class Rball:public ball {
int xc,yc;
double theta;
public:
Rball(double a,double b,int c,int d,int e,int f,double g):ball(a,b,c,d),xc(e),yc(f),theta(g) {}
void move()
{
hide();
double xr,yr;
xr=xc+(x-xc)*cos(theta)+(y-yc)*sin(theta);
yr=yc-(x-xc)*sin(theta)+(y-yc)*cos(theta);
x=xr;
y=yr;
show();
}};
void main() {
int g=0,m;
initgraph(&g,&m,"c:\\BC5\\BGI");
Rball p(400,240,15,14,320,240,0.1);
Rball q(480,240,10,2,320,240,0.2);
Tball z(320,240,5,15,5,5);
p.show();
q.show();
z.show();
while(!kbhit())
{
setcolor(7);
circle(320,240,80);
circle(320,240,160);
delay(30);
p.move();
q.move();
z.move();
}
closegraph();
}
ياليت اللي يقدر يلاقيلي حل يقوللي اياه