Hi, I need to do this program in my university and I was wondering how can I do it so that when there are no exits available, the program just says "type q to quite", and skips the 'Type the first letter of the next step or direction you want to take' bit.

Thank you very much in advance!

This is the part of the Code when i am setting that:

//Describe current Room
void DescribeRoom(unsigned int RoomNumber)
{
       printf("Welcome to my home, Mi casa es tu casa! \n\n\n");
       printf("%s. \n\n ", Room[RoomNumber].Description);
}

//Describe current Room Exits
   void DescribeExits(int RoomNumber)
{
       unsigned int exitdir;
       unsigned int exitcount = 0;
       for (exitdir = 0; exitdir < 14; exitdir++)
       {
       if (Room[RoomNumber].Exit[exitdir] > 0) exitcount++;
       }
       if (exitcount == 1) printf("You have %u options here: \n", exitcount);
       else printf("You have %u options here: \n", exitcount);
       if (Room[RoomNumber].Exit[0] > 0) printf("   North \n");
       if (Room[RoomNumber].Exit[1] > 0) printf("   East \n");
       if (Room[RoomNumber].Exit[2] > 0) printf("   West \n");
       if (Room[RoomNumber].Exit[3] > 0) printf("   Ups! Quick stop, I drunk too much water... \n");
       if (Room[RoomNumber].Exit[4] > 0) printf("   South \n");  
       if (Room[RoomNumber].Exit[5] > 0) printf("   Hm..Nice.. to the pocket! \n");
       if (Room[RoomNumber].Exit[6] > 0) printf("   Jump \n");
       if (Room[RoomNumber].Exit[7] > 0) printf("   Talk to her \n");
       if (Room[RoomNumber].Exit[8] > 0) printf("   Make noise to wake him up \n");
       if (Room[RoomNumber].Exit[9] > 0) printf("   Apologise repitetly \n");
       if (Room[RoomNumber].Exit[10] > 0) printf("   Yes, proceed with the visit \n");
       if (Room[RoomNumber].Exit[11] > 0) printf("   I did not at all, sorry madam \n");
       if (Room[RoomNumber].Exit[12] > 0) printf("   Oh yes, very nice (go somewhere hidden to vomit) \n");
       if (Room[RoomNumber].Exit[13] > 0) printf("   Leave running! \n"); 
       printf(" \n Type the first letter of the next step or direction you want to take \n");
}

//Get direction to go in
void GetDirection(char Direction[])
{
       printf("Type q to quit\n");
       scanf("%s", Direction);
       while(strlen(Direction) > 1)
       {
       printf("Clever..What didn't you understand? You may only type ONE letter - please try again\n");
       scanf("%s", Direction);
    }
}

how are the functions being called, could you post the main function?

how can I do it so that when there are no exits available, the program just says "type q to quite", and skips the 'Type the first letter of the next step or direction you want to take' bit.

use a condition for the value of Direction (if it's q don't pass the DescribeExits function)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.