Your indentation is horrid.
Code:
if (strcmp(name, "spencer") == 0 ) {
printf("Welcome to my program");
}
if (strcmp(name, "Spencer") == 0 ) {
printf("Welcome to my program");
}
else {
printf ("Welcome %s", name);
}
There. else statements are executed when the previous if statement is NOT executed. For example:
Code:
if (age < 18)
printf("You can not smoke cigarettes.\n");
else
printf("Light up, hophead!\n");
Just take out the first if statement in the code I posted above, and you should be good.