Professional Documents
Culture Documents
h>
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
void welcome();
void loading();
void read_instruction();
void show_details();
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);
gets(name);
menu:
system("cls");
printf("\n\t\t ------------------------------------");
printf("\n\n\t\ta.Start Game");
printf("\n\n\t\tb.Read instruction");
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);
chq=getche();
delay(100);
if(chq=='d')
sound(800);
delay(1000);
nosound();
getch();
break;
else
printf("\n\nIncorect answer");
sound(400);
delay(1000);
nosound();
getch();
clrscr();
goto finish;
case 2:
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')
sound(800);
delay(1000);
nosound();
getch();
break;
else
printf("\n\nIncorect answer");
sound(400);
delay(1000);
nosound();
getch();
clrscr();
goto finish;
case 3:
load(1000000);
disquest(qn3);
chq=getche();
delay(100);
if(chq=='a')
sound(800);
delay(1000);
nosound();
getch();
break;
else
printf("\n\nIncorect answer");
sound(400);
delay(1000);
nosound();
getch();
clrscr();
goto finish;
case 4:
load(10000000);
disquest(qn4);
chq=getche();
delay(100);
if(chq=='d')
sound(800);
delay(1000);
nosound();
getch();
break;
else
printf("\n\nIncorect answer");
sound(400);
delay(1000);
nosound();
getch();
clrscr();
goto finish;
}
case 5:
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')
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);
getch();
go_score(name,a);
getch();
// if(getch()>'a'||getch()<'z')
goto menu;
return 0;
//--------------------------------------------------------
void read_instruction()
gotoxy(5,5);
printf("\n\n INSTRUCTION");
printf("\n*******************************************************************************");
printf("\n-------------------------------------------------------------------------------");
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 ->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 ->If your question is wrong then you not able to see other question.");
printf("\n--------------------------------------------------------------------------------");
printf("\n--------------------------------------------------------------------------------");
printf("\n\n******************************************************************************")
;
getch();
clrscr();
//----------------------------------------------------------
{ clrscr();
int i,a=177;
gotoxy(25,10);
for(i=0;i<20;i++)
gotoxy(25+i,12);
printf("%c",a);
delay(100);
clrscr();
//-----------------------------------------------------------
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();
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");
getch();
//-----------------------------------------------------------------------
{
system("cls");
char nm[20];
FILE *f;
f=fopen("quizes.txt","r");
if(f==NULL)
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];
};
struct player p;
FILE *f;
f=fopen("quizes.txt","r");
if(f==NULL)
fscanf(f,"%s %ld",&p.name,&p.point);
gotoxy(10,10);
printf("\n*******************");
printf("\n\nName\t\t\tPrize Won");
printf("\n-------------------------------------------------------");
printf("\n%s\t\t\tRs. %ld",p.name,p.point);
printf("\n-------------------------------------------------------");
fclose(f);
getch();}