#include#include#include score will be calculated and displayed”);

#include#include#include #include#include#include#includevoid displayscore() { char name20; float s; FILE *f; system(“cls”); f=fopen(“score.txt”,”r”); fscanf(f,”%s%f”,&name,&s); printf(”

“); printf(”

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

%s has secured the Highest Score %.2f”,name,s); printf(”

“); fclose(f); getch(); }void help() { system(“cls”); printf(”

This game is very easy to play. You’ll be asked some general”); printf(”

knowledge questions and the right answer is to be chosen among”); printf(”

the four options provided. Your score will be calculated at the”); printf(”

end. Remember that the more quicker you give answer the more”); printf(”

score you will secure. Your score will be calculated and displayed”); printf(”

at the end and displayed. If you secure highest score, your score”); printf(”

will be recorded. So BEST OF LUCK.”); }void writescore(float score, char plnm20) { float sc; char nm20; FILE *f; system(“cls”); f=fopen(“score.txt”,”r”); fscanf(f,”%s%f”,&nm,&sc); if (score>=sc)   { sc=score;     fclose(f);     f=fopen(“score.txt”,”w”);     fprintf(f,”%s
%.2f”,plnm,sc);     fclose(f);   } }int main()     {     int countq,countr;     int r,i;     int pa;int nq6;int w;     float score;     char choice;     char playername20;     time_t initialtime,finaltime;     system(“cls”);     //randomize();     mainhome:     system(“cls”);     puts(”

“) ;     puts(”
——————————-“);     puts(”
Enter ‘S’ to start game       “);     puts(”
Enter ‘V’ to view high score  “);     puts(”
Enter ‘H’ for help            “);     puts(”
Enter ‘Q’ to quit             “);     printf(”

  “);     choice=toupper(getch());     if (choice==’V’) { displayscore(); goto mainhome; }     else if (choice==’Q’) exit(1);     else if (choice==’H’) { help(); getch(); goto mainhome; }    else if(choice==’S’){     system(“cls”);     printf(”

Enter your name…”);     printf(”
(only one word)

“);     gets(playername);     home:     system(“cls”);     initialtime=time(NULL);     countq=countr=0;     i=1;     start:     srand ( time(NULL) );     r=rand()%23+1;     nqi=r;     for (w=0;w=80 && score<100) printf(" VERY GOOD!!"); else if (score>=60 &&score<80) printf(" GOOD! BUT YOU NEED TO KNOW MORE."); else if (score>=40 && score<60) printf(" SATISFACTORY RESULT, BUT THIS MUCH IS MUCH SUFFICIENT."); else printf(" YOU ARE VERY POOR IN G.K.,WORK HARD"); puts(" NEXT PLAY?(Y/N)"); if (toupper(getch())=='Y')  goto home; else  {  writescore(score,playername);  goto mainhome;  } }     else { printf("   Enter the right key   "); Sleep(700); goto mainhome; } return 0;}


I'm Isaac!

Would you like to get a custom essay? How about receiving a customized one?

Check it out