Newsgroup: it.comp.lang.c++
Titolo: What's wrong in my C++ program? thx.

I am a newbie of C++
Pls debug this Turbo C++ program and point out what's wrong in my program.
Thx.
this program will comes 2 airplane and shoot one bullet when press 'a'
thx again
#include<dos.h>
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
void show(int i,float h, float v);
void erease(int i, float h, float v);
void planeshow(int i, int k);
void ereasep(int i, int k);
char read_key();
void main(void)
{
int driver = DETECT,mode;
int i,j,k;
int y=1, xx=0 ;
int a[100];
for (i=0; i<=99; i++)
 a[i]=0;
initgraph (&driver,&mode,"e:\\tc\\bgi");
setcolor(WHITE);
line(1,400,400,400);
j=1;
for (i=0 ; i<80; i++)
{
setcolor(BLUE); planeshow(5*i, 5);
show(i, 5.0, 9.0);
show(i-10, 10.0, 8.0);
if (read_key() == 'u') {xx=xx-8;}
if (read_key() == 'i') {xx=xx+8;}
if (read_key() == 'm') {j=j+1;a[j]=i;}
}
setcolor(YELLOW); planeshow(5*(i-8), xx);
for (k=2; k<=j; k++)
if (a[k]!=0) {show (i-a[k],10.0+0.5*k,8.0+0.1*k);}
delay(300);
ereasep(5*i,5); ereasep(5*(i-8),xx);
closegraph();
}
void show(int i, float h, float v)
{
 int x, y;
  x = h*i        ;
 y=v*i-0.15*i*i;
 setcolor(RED);
 circle(400-x, 400-y,2);
 }
 void erease(int i, float h, float v)
 {
 int x,y;
 x=h*i;
 y=v*i-0.15*i*i;
 setcolor(BLACK);
 circle (400-x,400-y,2);
 }
 void planeshow(int i, int k)
 {
 int j;
 circle (i+5, 202+k , 2);
circle (i+3, 204+k, 2);
 for (j=0; j<=8; j++)
 circle(i+j, 200+k, 2);
circle (i+5, 198+k, 2);
circle (i+3, 196+k, 2);
 }
 void ereasep (int i, int k)
 {
 int j;
 setcolor(BLACK);
 circle(i+5, 202+k, 2);
 circle(i+3, 204+k, 2);
 for (j=0; j<=8; j++)
 circle (i+j, 200+k, 2);
 circle (i+5, 198+k, 2);
 circle (i+3, 196+k, 2);
 }
char read_key()
 {
 int y;
 char x;
 _AH=0x01;
 geninterrupt(0x16);
 y=_FLAGS&0x40;
 if (y==0)
 {
 _AH=0x00;
 geninterrupt(0x16);
 x=_AL;
 return x;    }
 return '?' ;
 }

 thx again
No. First you have to say us:
what do you expect to happen when you do what.
what happens instead.
since your program uses lots of borland specific stuff:
you better should ask in a borland specific newsgroup.
in case that your problem is an algorithmic problem,
try to reduce your problem to the minimal code
that shows the problem without the use of compiler
specific functions (all graphic functions, the call
to geninterrupt).
if the source presented did not get mixed up during posting:
a better layout style may be extremly helpfull to find bugs.
-----------------------------------------------------------
Karl Heinz Buchegger
kbuc...@gascad.at

Thx.
Sorry, your program makes too much use of non-standard functions, so
we can't debug it. You will have a better chance in a group for
specific compiler. Borland supports a number of groups. Take a look at
http://www.borland.com/newsgroups
 for how to access them.
Bart v Ingen Schenau
-- 
FAQ for acllc-c++: 
http://www.raos.demon.co.uk/acllc-c++
Please reply to the group, so others can benefit also

 thx again
Did you read when I replied last time? Or are you sitting around waiting for
a private e-mail answer.
I told you the same things as a couple other regulars have. Please read
them.
--
 Phlip
======= 
http://users.deltanet.com/~tegan/home.html
 =======