Hi i recently made a really small quiz just as an exercise and i have an error that i don understand how can i correct, if you guys tell me how i am supposed to correct it ! i know that is related to the scanf but cant find why!
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char decision[50];
char question1[50];
char question2[50];
char question3[50];
printf("Welcome\n\aThis game was designed to be an example of a simple game!\n");
printf("The game will have 3 questions. If you want to play say (yes).\n");
scanf(" %s", decision);
if(strcmp(decision,"yes") == 0){
printf("Thank you for your time, goodluck!\n");
printf("Question 1.\n Who was the winner of Liga Nos in 2014/2015\n");
printf("a)Porto b)Benfica c)Sporting d)Braga\n");
scnaf(" %s", question1);
if(strcmp(question1,"b") == 0){
printf("Good job.\a\n Who won the ballon d'ore in 2016?\n");
printf("a)Ronaldo b)Neur c)Neymar d)Messi");
scnaf(" %s", question2);
if(strcmp(question2,"d") == 0){
printf("Good job.\a\n Last question. Who won puskas in 2016?\n");
printf("a)Alessandro Florenzi b)Leo Messi");
scnaf(" %s", question3);
if(strcmp(question3,"b") == 0){
printf("\nWell done you Won!");
}else{
printf("Sorry you are wrong! Maybe next time!\a\n");
}
}else{
printf("Sorry you are wrong! Maybe next time!\a\n");
}
}else{
printf("Sorry you are wrong! Maybe next time!\a\n");
}
}else{
printf("Thank you anyway!\n\a");
}
return 0;
}
ty guys ^^