Thread: Help, Debug Problem

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Help, Debug Problem

    I have a problem. I'm using Borland C++. When I run the program it skips where you get the axe. Just in case you were wondering the order of the game is PUNCH then GET AXE... Sorry about the capitalization but in the game you have to have caps locks on. It doesn't say anything when you say GET AXE. If you could, can you look at my code... Run it... and see whats wrong... It'd be a big help... I can't find the problem.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    Well don't be shy, show us your code.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212

    Re: Help, Debug Problem

    Originally posted by drdroid
    but in the game you have to have caps locks on.
    Why?

  4. #4
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Talking Sorry, I wan't paying attention...

    Heres the code... Sorry, again.

    //Filename: lv1.cpp
    //Function: Level 1
    #include <iostream.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <string.h>
    void main()
    {
    int keyamt=0;
    int lp=1;
    int lvlaxe=0;
    int axeamt=0;
    unsigned char gtaxe[]="GET AXE";
    unsigned char pnch[]="PUNCH";
    unsigned char undr[]="UNLOCK DOOR";
    unsigned char north[]="NORTH";
    unsigned char south[]="SOUTH";
    unsigned char west[]="WEST";
    unsigned char east[]="EAST";
    int pstx=1;
    int psty=1;
    unsigned char chc1[20];
    unsigned char getkys[]="GET KEYS";
    unsigned char getchc[20];
    unsigned char inv[]="INVENTORY";
    cout << "LEVEL ONE" << endl;
    cout << "ESCAPE FROM THE DUNGEON" << endl;
    cout << endl << "YOUR IN A DARK DUNGEON CELL." << endl;
    cout << "THE WALLS ARE COVERED WITH MOSS AND COBWEBS." << endl;
    cout << "THE GUARD COMES IN TO GIVE YOUR FOOD." << endl;
    while(lp!=0)
    {
    cout << ">";
    cin.getline(chc1,20);
    if(!strcmp(chc1,pnch))
    {
    clrscr();
    cout << "THE GUARD LIES UNCONSCIOUS ON THE FLOOR." << endl;
    cout << "HIS BATTLE AXE SEEMS TO HAVE SLIPED AWAY FROM HIM" << endl;
    lvlaxe+1;
    }
    if(!strcmp(chc1,gtaxe))
    {
    if(lvlaxe==1)
    {
    clrscr();
    cout << "YOU PICKED UP THE AXE." << endl;
    axeamt+1;
    }
    }
    }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  3. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM