The following code has one simple error.....

This is a discussion on The following code has one simple error..... within the A Brief History of Cprogramming.com forums, part of the Community Boards category; The following code has one simple error: Undefined simbol 'B' can someone help me????? PS: i am making a simple ...

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    The following code has one simple error.....

    The following code has one simple error: Undefined simbol 'B'
    can someone help me?????

    PS: i am making a simple invader game. so far no bullet is being shot but the object will be.
    _________________________________
    #include <iostream.h>
    #include <conio.h>
    #include <stdlib.h>

    int main()
    {
    {
    int b = 0;//B is the number 0
    int z = 25;
    int w = 5;
    gotoxy(z, w);
    putch(b);//puts the variable B at z, w coordinates.
    }
    int x = 15;
    int y = 25;
    int a = 1;
    while(a==1)
    {
    char cl = getch();
    if (cl==77)
    {
    clrscr();
    gotoxy(x++, y);
    putch('Y');
    gotoxy(x++, y);
    }
    if (cl==75)
    {
    clrscr();
    gotoxy(x--, y);
    putch('Y');
    gotoxy(x--, y);
    }
    if (cl==32)
    {
    if (b==x, y-20)//THE ERROR IS OVER HERE!!!!!
    {
    clrscr();
    gotoxy(x, y);
    putch('@');
    }
    }
    if (cl==27)
    {
    exit(0);
    }
    }
    return 0;
    }
    ____________________________________
    How do you fix it??
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    y-20? he he....

  3. #3
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    not that funny.....
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  4. #4
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    The if(b==x, y-20) looks a little odd.

    Try something like

    if((b == x) && (y == something))

    then your cursor movement here
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  5. #5
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    y -= 20;
    if you were meaning to subtract 20 from y. and you MIGHT want to set y-=20; above the if statement, then just use y in the statement itself.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21