Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int main(){
int level;
char option,choice;
printf("\tQuiz related to IT & G.K.\n\n");
printf("\tPress S to start the quiz.\n\n");
printf("\tPress V to view score.\n\n");
printf("\tPress H for help.\n\n");
printf("\tPress Q to quit.\n\n");
printf("_______________________________________\n\t");
scanf("%c",&option);
if(option=='S'||option=='s'){
printf("_______________________________________\n");
printf("\tChoose a difficulty level:\n\t1)Easy.\n\t2)Medium.\n\t3)Hard.\n");
printf("_______________________________________\n\t");
scanf("%d",&level);
if(level==1){
system("cls");
printf("\tQuiz started!\t\t\t\t\t\t\t\t\tTime Allowed:30MIN\n\n\t");
FILE *fp;
fp = fopen("sample.txt", "r");
char ques[200];
while(!feof(fp)){
fgets(ques,200,fp);
puts(ques);
}
fclose(fp);
scanf("%c",&choice);
if (choice=='B'&&choice=='C'&&choice=='D')
printf("Incorrect answer,A is the right answer\n\t");
else
printf("Correct\n\t");
return 0;
}
}
}