I can't seem to figure out what's wrong with this. It compiles fine, but no matter what I put in, be it yes or no, it skips over the "let's begin" line and goes straight to the end.
#include<stdio.h>
#include<stdlib.h>
int main(){
char response[5];
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("Would you like to go on an adventure?\n Enter Yes or No:");
scanf("%s", response);
if (response == "yes"){
printf("Let's begin!");
}
else (response == "no");{
printf("See you later then!");
}
return 0;
}
Does the scan need to be moved, or did I just screw it up somehow?
Aucun commentaire:
Enregistrer un commentaire