UNKNOWN //************************************** // Name: Simple Quiz // Description:This code is dedicated to action stars of the millenium..... // By: Italian Stallion // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.14193/lngWId.3/qx/vb/scripts/ShowCode.htm //for details. //************************************** // Dedicated to the Action Men - Arnold Schwarzenegger, Sylvester Stallone. #include <iostream.h> #include <conio.h> #include <graphics.h> #include <dos.h> #include <stdlib.h> #include <stdio.h> #include <string.h> void qbox() { rectangle(20,20,620,80); rectangle(20,90,300,140); rectangle(320,90,620,140); rectangle(20,150,300,200); rectangle(320,150,620,200); } void prgbar() { rectangle(20,400,620,430); setfillstyle(1,RED); for(int i=1;i<=598;i++) { delay(20); bar(21,401,21+i,429); } } void rocky() { int l=0; char str[100],name[100]; outtextxy(50,100,"Enter your name.:"); rectangle(200,90,380,115); gotoxy(28,7); gets(name); outtextxy(50,150,"Enter your seat no:"); rectangle(200,140,380,165); gotoxy(28,10); cin>>l; itoa(l,str,10); setcolor(BLACK); bar3d(180,200,400,230,4,1); outtextxy(200,210,"Press Enter To Submit"); setcolor(WHITE); getch(); } void qtech(char qst[],char a1[],char a2[],char a3[],char a4[],int k) { int ans=0; outtextxy(30,30,qst); outtextxy(30,100,a1); outtextxy(330,100,a2); outtextxy(30,160,a3); outtextxy(330,160,a4); outtextxy(33,225,"Enter your choice"); gotoxy(29,15); cin>>ans; if(k==ans && ans==1) { delay(4000); outtextxy(150,400,"Right answer"); setfillstyle(1,GREEN); floodfill(21,93,getmaxcolor()); } if(k==ans && ans==2) { delay(4000); outtextxy(150,400,"Right answer"); setfillstyle(1,GREEN); floodfill(323,93,getmaxcolor()); } if(k==ans && ans==3) { delay(4000); outtextxy(150,400,"Right answer"); setfillstyle(1,GREEN); floodfill(23,153,getmaxcolor()); } if(k==ans && ans==4) { delay(4000); outtextxy(150,400,"Right answer"); setfillstyle(1,GREEN); floodfill(323,153,getmaxcolor()); } if(k==1 && ans==2) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,93,getmaxcolor()); delay(4000); exit(0); } if(k==1 && ans==3) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,93,getmaxcolor()); delay(4000); exit(0); } if(k==1 && ans==4) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,93,getmaxcolor()); delay(4000); exit(0); } if(k==2 && ans==1) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,93,getmaxcolor()); delay(4000); exit(0); } if(k==2 && ans==3) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,93,getmaxcolor()); delay(4000); exit(0); } if(k==2 && ans==4) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,93,getmaxcolor()); delay(4000); exit(0); } if(k==3 && ans==1) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,153,getmaxcolor()); delay(4000); exit(0); } if(k==3 && ans==2) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,153,getmaxcolor()); delay(4000); exit(0); } if(k==3 && ans==4) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(23,153,getmaxcolor()); delay(4000); exit(0); } if(k==4 && ans==1) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,153,getmaxcolor()); delay(4000); exit(0); } if(k==4 && ans==2) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(323,93,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,153,getmaxcolor()); delay(4000); exit(0); } if(k==4 && ans==3) { delay(4000); outtextxy(150,400,"Wrong answer"); setfillstyle(1,RED); floodfill(23,153,getmaxcolor()); setfillstyle(1,GREEN); floodfill(323,153,getmaxcolor()); delay(4000); exit(0); } delay(4000); } void typeit (int x,int y,int del,int spacing,char string[]) { char ach[2]; for (int i=0;i<strlen(string);i++) { delay(del); ach[0]=string[i]; ach[1]='\0'; outtextxy(x+(i+1)*spacing,y,ach); }//endfor } void main() { clrscr(); int gd=DETECT,gm,*b,*x,*y; initgraph(&gd,&gm,"c:\\tc\\bgi"); rocky(); typeit(210,260,40,10,"Programmed By:"); typeit(160,300,150,10,"NARAYAN SUBHASH LOKE"); prgbar(); cleardevice(); qbox(); qtech("What is electron mass ?","1) 1.66","2) 3.23","3) 2.332","4) 12.3",1); cleardevice(); qbox(); qtech("What is OO7 ?","1)License to pray","2)License to kill","3)License to bill","4)License to neel",2); cleardevice(); qbox(); qtech("Which of these is a Stallone movie?","1)Twilight","2)True Lies","3)Rocky","4)Terminator",3); cleardevice(); qbox(); qtech("Which of these animals are now extinct?","1)Boa","2)Polar Bear","3)Red Panda","4)Dinosaur",4); cleardevice(); qbox(); qtech("Who is author of book \"Think and grow rich\"?","1)Salman Rushdie","2)Napolean Hill","3)Owen Wilson","4)Edward Furlong",2); cleardevice(); qbox(); qtech("Who is author of \"You can win\"?","1)Sly Stallone","2)Sanyo","3)Ray Tango","4)Shiv Khera",4); getch(); closegraph(); }