My if statements aren't working and I am not sure why. Can someone point out my error, thank you. This is just a kinda dumb program I am making just for practice, I am setting a lot more variables along the way.
#include <stdio.h>
main()
{
//This is a program that determines what circle of hell the user will be put in. Inspired by Dante's Divine Comedy
char firstQuestion;
float total = 0;
printf("ABANDON ALL HOPE, YOU WHO ENTER HERE\n\n");
printf("Welcome to the gate of hell. I am going to ask you a series of questions and you will answer them truthfully.\n\n\n");
printf("I would first like to ask you, do you believe you are a good person?(Y or N)\n");
scanf_s(" %c", &firstQuestion);
if (firstQuestion == 'Y'){
printf("We will see about that.\n");
total = total + 10;
}
else if (firstQuestion == 'N'){
printf("I'm not surprised.\n");
}
return 0;
}
main()
-->int main(void)
– Sourav Ghosh=='Y' || ... =='y'
because your inputs are case-sensitive – Tobias Knaussscanf
which is not the same asscanf_s
. See Nishant's answer below. – Jabberwocky