updated code:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char c, f, r;
int age;
printf( "The purpose of this questionnaire is to determine your eligibility to vote.\n" );
puts( "Please enter your age: " );
scanf( "%d", &age );
if (age >=18){
printf("Are you a legal citizen of the United States? Please enter Y or N\n");
scanf("%c", &c);
}
if (c == 'y' || c =='Y'){
printf("Are you registered to vote? Please enter Y or N\n");
scanf("%c", &r);
}
if (r == 'y' || r =='Y'){
printf("Have you been convicted of any felonies? Please enter Y or N\n");
scanf("%c", &f);
}
if ( f == 'n' || f == 'N'){
printf("Thank you for completing this questionnaire! You are eligible to vote!\n");
}
else if (f =='y'||f == 'Y'){
printf("You are NOT eligible to vote!\n");
}
else if (r == 'n' || r == 'N'){
printf("You are NOT eligible to vote!\n");
}
else if (c == 'n' || c == 'N'){
printf("You are NOT eligible to vote!\n");
}
else if (age <18){
printf("You are NOT eligible to vote!\n");
}
system("PAUSE");
return 0;
}
still doesn't execute properly, it "fails" correctly, but if the age is >18 it asks the next question then just ends w/o any user input