There are a few issues to be resolved here...
1. To properly declare a variable named marcode, you will need a comma between the declaration of marcode and the declaration of single so the compiler realizes there are two separate declarations of type char.
2. You prompt the user for a marriage code, and are placing that imput into a variable of type char. From that, I'm assuming you are expecting the user to enter one of the for letters = s,m,w,d. You are then switching on the value of marcode, which should be one of those values, but your case statements are using integers...they should be using characters.
3. You have no deafuly case statement - not a requirement, simply a wise precaution.
4. You are printing out a word, and then indicate that you will be printint out an addtional character, but you do not supply the character.
5. Your if statement is merely checking that marcode is true...as long as theuser has entered something, this will evaluate to true, and throw the statement.
Below is a simplified version that may be an example of what you are trying to achieve:
CODE
#include <stdio.h>
int main()
{
char marcode;
printf("Enter a marital code: ");
scanf("%c",&marcode);
switch (marcode)
{
case 's':
printf("Single\n");
break;
case 'm':
printf("Married\n");
break;
case 'w':
printf("widowed\n");
break;
case 'd':
printf("divorced\n");
break;
default:
printf("\nAn invalid code was entered.\n");
break;
}
return 0;
}
EDIT: Slower typer than louisda16th!