Important alert: (current site time 7/15/2013 4:15:16 AM EDT)
 

VB icon

Simple Quiz

Email
Submitted on: 6/7/2013 1:30:52 AM
By: Italian Stallion  
Level: Beginner
User Rating: Unrated
Compatibility: C, C++ (general), Borland C++
Views: 1407
(About the author)
 
     This code is dedicated to action stars of the millenium.....
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Simple Quiz
// Description:This code is dedicated to action stars of the millenium.....
// By: Italian Stallion
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=14193&lngWId=3//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();
}


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.