From the course: Complete Guide to C Programming Foundations

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Chapter challenge: Interpreting commands

Chapter challenge: Interpreting commands - C Tutorial

From the course: Complete Guide to C Programming Foundations

Chapter challenge: Interpreting commands

(upbeat music) - [Instructor] You've been tasked with writing a command interpreter for a text mode video game. Here's the program running in this window. The solution for this challenge, the program outputs a prompt command. If the user doesn't know what to type, they can type a question mark and then they can see which commands they can type. So you can go right, you can go left, or you can go back. I've even written into the code that you can type in full words such as, RIGHT and in lowercase and unknown commands are also dealt with. Type Q to quit. Here's the code skeleton to get you started. Variable declarations go here. The program spins in this while loop where the condition is the value of variable done. It's initially set to false at line 12. You must add statements to prompt for input. Process the input, then evaluate the results, outputting the messages as shown earlier. Here are the details. Convert the double slash comments in the challenge exercise file into C language…

Contents