Hi, I'm making a console-based connect four game as a beginner project, I want have the user input a command in this syntax, "drop <int column_number>" to drop a coin. The problem is how! I want to be able to seperate the number from the command a store it into a seperate variable - and if the syntax is not as expect, I do not want the program to crash, I want it to just ask again.
I have tried something like below, which kind of works and then crashes straight after. My understanding of scanf() is limited because I do not have the MSDN library.My understanding is that where %d is, is the value that will be put into col - please correct me if I am wrong.PHP Code:
scanf("drop %d", &col);