You are on page 1of 14

#include<conio.

h>

#include<stdio.h>

#include<dos.h>

#include<stdlib.h>

#include<math.h>

#include<string.h>

void welcome();

void loading();

void read_instruction();

void go_score(char [],long int);

void show_details();

void load(long int );

void disquest( char []);

long int n,a;

char name[20];

int main()

long int p;

int i;

char pnm[30];

char choice,chq;

clrscr();

welcome();

system("cls");

loading();

clrscr();
gotoxy(25,10);

printf("ENTER YOUR NAME: ");

gets(name);

menu:

system("cls");

printf("\n\n\n\n\t\tMr.%s select any one option",name);

printf("\n\t\t ------------------------------------");

printf("\n\n\t\ta.Start Game");

printf("\n\n\t\tb.Read instruction");

printf("\n\n\t\tc.View Highest Prize winer");

printf("\n\n\t\td.Quit");

choice=getche();

clrscr();

switch(choice)

case 'b':

read_instruction();

goto menu;

case 'c':

show_details();

goto menu;

case 'd':

exit(1);

case 'a':

for (i=1;i<=5;i++)
{

n=i;

switch (i)

case 1:

char qn1[200]="1.Which two cricketers have the highest last wicket patnership in cricket history?";

load(10000);

disquest(qn1);

printf("\na.Kohli and I sharma\t\t\tb.S smith and M Starc\nc. Willamson and Southee\t\t\td.Root


and J anderson\n");

chq=getche();

delay(100);

if(chq=='d')

printf("\n\nCorrect answer!!!!\n press any key to continue to the next question");

sound(800);

delay(1000);

nosound();

getch();

break;

else

printf("\n\nIncorect answer");

sound(400);

delay(1000);

nosound();
getch();

clrscr();

goto finish;

case 2:

char qn2[200]="2.When did Nepal get the membership of UN?";

load(100000);

disquest(qn2);

printf("\na.1945\t\t\tb.1944\nc. 1954\t\t\td.1955\n");

chq=getche();

delay(100);

if(chq=='d')

printf("\n\nCorrect answer!!!!\n press any key to continue to the next question");

sound(800);

delay(1000);

nosound();

getch();

break;

else

printf("\n\nIncorect answer");

sound(400);

delay(1000);

nosound();

getch();
clrscr();

goto finish;

case 3:

char qn3[200]="3.Which team won Aaha Rara Goldcup?";

load(1000000);

disquest(qn3);

printf("\na.Manang Marshyangdi\t\t\tb.Shahara FC\nc.Three Star FC\t\t\td.Jhapa XI\n");

chq=getche();

delay(100);

if(chq=='a')

printf("\n\nCorrect answer!!!!\n press any key to continue to the next question");

sound(800);

delay(1000);

nosound();

getch();

break;

else

printf("\n\nIncorect answer");

sound(400);

delay(1000);

nosound();

getch();

clrscr();
goto finish;

case 4:

char qn4[200]="4.Which is the bird found only in Nepal?";

load(10000000);

disquest(qn4);

printf("\na.Horn Bill\t\t\tb.Peacock\nc. Lophophorous\t\t\td.Spiny Babbler\n");

chq=getche();

delay(100);

if(chq=='d')

printf("\n\nCorrect answer!!!!\n press any key to continue to the next question");

sound(800);

delay(1000);

nosound();

getch();

break;

else

printf("\n\nIncorect answer");

sound(400);

delay(1000);

nosound();

getch();

clrscr();

goto finish;
}

case 5:

char qn5[200]="5.Which district has identical map to Nepal?";

load(100000000);

disquest(qn5);

printf("\na.Baglung\t\t\tb.Parbat\nc.Kathmandu\t\t\td.Kaski\n");

chq=getche();

delay(100);

if(chq=='a')

printf("\n\nCorrect answer!!!!\n press any key to continue to the next question");

sound(800);

delay(1000);

nosound();

getch();

break;

else

printf("\n\nIncorect answer");

sound(400);

delay(1000);

nosound();

getch();

clrscr();

goto finish;

}
}

finish:

gotoxy(10,10);

a=1000*pow(10,n-1);

printf("!!!badhai Xa Mr./Mrs %s tapaile ABC ma Rs %ld jitnu vayeko xa!!!",name,a);

getch();

go_score(name,a);

printf("\n\n Enter any key to go main mainu");

getch();

// if(getch()>'a'||getch()<'z')

goto menu;

return 0;

//--------------------------------------------------------

void read_instruction()

gotoxy(5,5);

printf("\n\n INSTRUCTION");
printf("\n*******************************************************************************");

printf("\n Sample Quiz Game in C programming ");

printf("\n-------------------------------------------------------------------------------");

printf("\n There are the following instruction");

printf("\n ->There are total 5 question.If you give correct answer of all then you");

printf("\n win maximum of Rs.10000000.Or if you did not give correct answer of ");

printf("\n anyone of them then you win 1000 for participate in this game.");

printf("\n ->You will be given 4 options and you have to press a, b ,c or d for the");

printf("\n right option.");

printf("\n ->If you chose other than a,b,c,d then it is counted as incorrect answer.");

printf("\n ->You will be asked questions continuously if you keep giving the right ");

printf("\n answer.And prize money also increases by 10*previous value.");

printf("\n ->If your question is wrong then you not able to see other question.");

printf("\n--------------------------------------------------------------------------------");

printf("\n\n\ ** HAVE A NICE DAY **");

printf("\n--------------------------------------------------------------------------------");

printf("\n\n\ C PROGRAM ABC QUIZ GAME is developed by team");

printf("\n\n******************************************************************************")
;

getch();

clrscr();

//----------------------------------------------------------

void load(long int x)

{ clrscr();
int i,a=177;

gotoxy(25,10);

printf("loading for Rs %ld ",x);

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

gotoxy(25+i,12);

printf("%c",a);

delay(100);

clrscr();

//-----------------------------------------------------------

void disquest(char qn[])

int i;

for(i=0;i<strlen(qn);i++)

printf("%c",qn[i]);

delay(30);

void loading()

clrscr();
int i,a=177;

gotoxy(25,10);

printf("loading!!!");

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

gotoxy(38,10);

printf("%d%",((i+1)*5));

gotoxy(25+i,12);

printf("%c",a);

sound(300);

delay(50);

nosound();

delay(50);

//---------------------------------------------------------

void welcome()

int i;

clrscr();

char a[21]={"!!!WELCOME TO ABC!!!"};

char b[27]={"AAUNUHOS BANNUHOS CROREPATI"};

clrscr();
gotoxy(27,10);

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

printf ("%c",a[i]);

sound(500);

delay(50);

nosound();

delay(50);

printf("\n\t\t--------------------------------------------");

gotoxy(23,12);

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

printf ("%c",b[i]);

sound(500);

delay(50);

nosound();

delay(50);

printf("\n\t\t--------------------------------------------\n");

printf("\n\n\n\n\n\t\t DEVELOP BY:GAURAV GYANENDRA BISHAL KISHOR\n\t\t\t\t 073 BCE CD");

getch();

//-----------------------------------------------------------------------

void go_score(char plnm[30],long int n)

{
system("cls");

long int fr;

char nm[20];

FILE *f;

f=fopen("quizes.txt","r");

if(f==NULL)

printf("\n not created");

exit(0);

fscanf(f,"%s %ld",&nm,&fr);

if(n>=fr)

fr=n;

fclose(f);

f=fopen("quizes.txt","w");

fprintf(f,"%s\t%ld",plnm,fr);

fclose(f);}}

//------------------------------------------------------------------

void show_details()

{system("cls");

struct player

char name[30];

long int point;

};

struct player p;
FILE *f;

f=fopen("quizes.txt","r");

if(f==NULL)

printf("\n not opened");

fscanf(f,"%s %ld",&p.name,&p.point);

gotoxy(10,10);

printf("\nHighest Prize Woner Details:");

printf("\n*******************");

printf("\n\nName\t\t\tPrize Won");

printf("\n-------------------------------------------------------");

printf("\n%s\t\t\tRs. %ld",p.name,p.point);

printf("\n-------------------------------------------------------");

printf("\n\nMr./Mrs. %s Won Highest of Rs. %ld Amount in this ABC game",p.name,p.point);

fclose(f);

getch();}

You might also like