I want to make a program which asks a number and then executes the tasks linked to that number, but I'm having a hard time figuring out how to read a 2digit number.
Let us assume the following prog (simplified version of what I'm doing atm)
You don't need the single quotes around the case number.
In general, numbers need no quotes, single letters need single quotes and strings need double straight quotes.
kinda prefere to keep it char, 'cause I got another command which includes a letter to do another task ,so int won't work here. Besides if one would input a letter in your code , the prog goes haywire :p
You don't need the single quotes around the case number.
In general, numbers need no quotes, single letters need single quotes and strings need double straight quotes.
Using char , so if I'd leave the quotes away it would look for the ASCII value , which isn't the same as the int value :)
Then you need to use a string, and then convert to int. There is no way to hold "10" inside a char. You could do it in a char* or char array, but it would be much simpler to store it into an int. And then write another function to handle the char.