Write your question here.
So I am writing a program to help improve my C/C++ skills. It is loosely based on D&D rules and I am working on the fighting system. This is to be a very simple text based game and I will expand upon it later. For now I am just looking to start slowly and grow the code into something more robust. What I have is a very odd problem, I do not get a compile error but when I try to run the program it crashes. This is the section that I think my problems lies, it is a very simple if else, else if section but it will not go beyond the first printf without crashing. Please help
scanf("%d", &Action); /*no need for '\n' in scanf and when using ints, have '&' in front of the name*/
switch(Action)
{
case 1:
//actions
break;
case 2:
//actions
break;
default:
printf("invalid input\n");
break;
}
try working with this setup. It may fix your problem.