Question & Answer: Write a “quiz” program on a topic, about which you are knowledgeable. This quiz can be work related, general kno…..

I need Help with this using the C# program

Write a “quiz” program on a topic, about which you are knowledgeable. This quiz can be work related, general knowledge or any set of questions where there is a specific answer. Ignore questions where long descriptions or general answers needed. The program should display the questions, one at a time, and possible answers, and accept an answer from the user. If the answer is correct, the program should go on to the next question. If it is incorrect, store the question for the second attempt and go on to the next question. When the list of questions has ended, the questions that were missed previously, or answered incorrectly, should be displayed again, in their original order. Keep a count of the correct answers for each category of questions and display the final count after two attempts. Also, display the correct answer, when necessary, in the second round of questioning.

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Write a “quiz” program on a topic, about which you are knowledgeable. This quiz can be work related, general kno…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

Limit the quiz to ten (10) questions. Include questions from both true/false and multiple-choice categories. Four (4) possible answers should be listed in multiple-choice questions.

Expert Answer

 

#include<stdio.h>

#include<conio.h>

#include <windows.h>

#include<ctype.h>

#include<stdlib.h>

#include<time.h>

#include<dos.h>

void displayscore()

{

char name[20];

float s;

FILE *f;

system(“cls”);

f=fopen(“score.txt”,”r”);

fscanf(f,”%s%f”,&name,&s);

printf(“nntt “);

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

printf(“nntt “);

fclose(f);

getch();

}

void help()

{

system(“cls”);

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

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

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

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

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

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

printf(“nntwill be recorded. So BEST OF LUCK.”);

}

void writescore(float score, char plnm[20])

{

float sc;

char nm[20];

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,”%sn%.2f”,plnm,sc);

fclose(f);

}

}

int main()

{

int countq,countr;

int r,i;

int pa;int nq[6];int w;

float score;

char choice;

char playername[20];

time_t initialtime,finaltime;

system(“cls”);

//randomize();

mainhome:

system(“cls”);

puts(“ntt WELCOME TO I.Q. TEST PROGRAMnn”) ;

puts(“ntt——————————-“);

puts(“ntt Enter ‘S’ to start game “);

puts(“ntt Enter ‘V’ to view high score “);

puts(“ntt Enter ‘H’ for help “);

puts(“ntt Enter ‘Q’ to quit “);

printf(“ntt——————————-nntt “);

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(“nnntttEnter your name…”);

printf(“nttt(only one word)nnttt”);

gets(playername);

home:

system(“cls”);

initialtime=time(NULL);

countq=countr=0;

i=1;

start:

srand ( time(NULL) );

r=rand()%23+1;

nq[i]=r;

for (w=0;w<i;w++)

if (nq[w]==r) goto start;

switch(r)

{

case 1:

printf(“nnWhat is the maximum no. of asymptotes of the curve x^4+2x+6=0?”);

printf(“nnA.4tB.3nnC.nonetD.infinitenn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.4”);break;}

case 2:

printf(“nnnHow many points are possible in a compound pendulum about which”);

printf(“time period is same?”);

printf(“nnA.4tB.2nnC.nonetD.infinitenn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

printf(“nnWrong!!! The correct answer is A.4”);

break;

case 3:

printf(“nnnWho was the first US President?”);

printf(“nnA.Richard NiksontB.Abraham LinkonnnC.John F. KennedytD.George Washingtonnn”);

countq++;

if (toupper(getch())==’D’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is D.George Washington”);break;}

case 4:

printf(“nnnWho was awarded the ‘Man of the Tournament’ of ICC WORLD CUP 2007?”);

printf(“nnA.Glen MagrathtB.Mahela JawardannnC.Mathew HaydentD.Sachin Tendulkarnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.Glen Magrath”);break;}

case 5:

printf(“nnnWhich country won the Fifa World Cup 1998?”);

printf(“nnA.FrancetB.BrazilnnC.ItalytD.Englandnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.France”);break;}

case 6:

printf(“nnnWhich syllabe is stressed in the word ‘democracy’?”);

printf(“nnA.1sttB.2ndnnC.3rdtD.4thnn”);

countq++;

if (toupper(getch())==’B’ )

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is B.2nd”);break;}

case 7:

printf(“nnnWhich country was the winner of Cricket World Cup 1987?”);

printf(“nnA.West IndiestB.IndiannC.AustraliatD.Englandnn”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.Australia”);break;}

case 8:

printf(“nnnWhat is the height of Mount everest in feet?”);

printf(“nnA.8648tB.6648nnC.8884tD.8848nn”);

countq++;

if (toupper(getch())==’D’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!!

The correct answer is D.8848”);break;}

case 9:

printf(“nnnWhat is the capital of Denmark?”);

printf(“nnA.CopenhagentB.HelsinkinnC.RomettD.Madridnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.Copenhagen”);break;}

case 10:

printf(“nnnWhich syllabe is stressed in the word ‘instanteneous’?”);

printf(“nnA.1sttB.2ndnnC.3rdtD.4thnn”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.3rd”);break;}

case 11:

printf(“nnnWho was the only player to score 6 successive sixes in an over?”);

printf(“nnA.Adam GilchristtB.M.S.DhoninnC.Herschel GibbstD.Sanath Jayasuryann”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.Herschel Gibbs”);break;}

case 12:

printf(“nnnWho was the only player to take 4 successive wickets?”);

printf(“nnA.Malinga BandaratB.Lasith MalingannC.Bret LeetD.Murali Darannn”);

countq++;

if (toupper(getch())==’B’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is B.Lasith Malinga”);break;}

case 13:

printf(“nnnWhich country is hosting the Fifa World Cup 2010?”);

printf(“nnA.South AfricatB.ItalynnC.ArgentinatD.Spainnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.South Africa”);break;}

case 14:

printf(“nnnWho is the author of ‘Pulpasa Cafe’?”);

printf(“nnA.Narayan WagletB.Lal Gopal SubedinnC.B.P. KoiralatD.Khagendra Sangraulann”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.Narayan Wagle”);break;}

case 15:

printf(“nnnWhich country is Maria Sarapova from?”);

printf(“nnA.RussiatB.SwitzerlandnnC.ArgentinatD.Spainnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.Russia”);break;}

case 16:

printf(“nnnWho was awarded the youngest player award in Fifa World Cup 2006?”);

printf(“nnA.Wayne RooneytB.Lucas PodolskinnC.Lionel MessitD.Christiano Ronaldonn”);

countq++;

if (toupper(getch())==’B’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is B.Lucas Podolski”);break;}

case 17:

printf(“nnnWhat is the smallest district of Nepal?”);

printf(“nnA.LalitpurtB.KarnalinnC.BhaktapurtD.Gulminn”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.Bhaktapur”);break;}

case 18:

printf(“nnnWhat is the headquarter of Western Development Region?”);

printf(“nnA.DhankutatB.KathmandunnC.DhangadhitD.Pokharann”);

countq++;

if (toupper(getch())==’D’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is D.Pokhara”);break;}

case 19:

printf(“nnnWhich place is called ‘The Cherrapunji of Nepal’?”);

printf(“nnA.DharantB.KathmandunnC.PokharatD.Butwalnn”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.Pokhara”);break;}

case 20:

printf(“nnnWhich city is known at ‘The City of Seven Hills’?”);

printf(“nnA.RometB.Vactican CitynnC.MadridtD.Berlinnn”);

countq++;

if (toupper(getch())==’A’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is A.Rome”);break;}

case 21:

printf(“nnnWho was the F1 racing champion of 2006?”);

printf(“nnA.Louis HamiltontB.Felipe MassannC.Fernando AlonsotD.Michael Schumakernn”);

countq++;

if (toupper(getch())==’C’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is C.Fernanda Alonso”);break;}

case 22:

printf(“nnnWho won the Women Australian Open 2007?”);

printf(“nnA.Martina HingistB.Maria SarapovannC.Kim ClijstertD.Serena Williamsnn”);

countq++;

if (toupper(getch())==’D’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is D.Serena Williams”);break;}

case 23:

printf(“nnnName the country where there no mosquito is found?”);

printf(“nnA.GermanytB.SpainnnC.JapantD.Francenn”);

countq++;

if (toupper(getch())==’D’)

{printf(“nnCorrect!!!”);countr++; break;}

else

{printf(“nnWrong!!! The correct answer is D.France”);break;}

}

i++;

if (i<=5) goto start;

finaltime=time(NULL);

score=(float)countr/countq*100-difftime(finaltime,initialtime)/3;

if (score<0) score=0;

printf(“nnnYour Score: %.2f”,score);

if (score==100) printf(“nnEXCELLENT!!! KEEP IT UP”);

else if (score>=80 && score<100) printf(“nnVERY GOOD!!”);

else if (score>=60 &&score<80) printf(“nnGOOD! BUT YOU NEED TO KNOW MORE.”);

else if (score>=40 && score<60) printf(“nnSATISFACTORY RESULT, BUT THIS MUCH IS MUCH SUFFICIENT.”);

else printf(“nnYOU ARE VERY POOR IN G.K.,WORK HARD”);

puts(“nnNEXT PLAY?(Y/N)”);

if (toupper(getch())==’Y’)

goto home;

else

{

writescore(score,playername);

goto mainhome;

}

}

else

{

printf(“nntt Enter the right keynntt “);

Sleep(700);

goto mainhome;

}

return 0;

}

Still stressed from student homework?
Get quality assistance from academic writers!