Quiz Game in c++ Programming


 #include<iostream>
#include "stdio.h"
#include<string>
#include<conio.h>
using namespace std;
int start();
int rule();
int history();
int main()
{
	int v;

	cout << "\n\n\t\t\t        * Quiz Game *";
	cout << "\n\n\t\t\t        *************";
	cout << "\n\n\t\t==============================================================";
	cout << "\n\n\t\tDeveloped By :Faisal Abdul Ghani , Abdul Wahab And Bilal zahid ";
	cout << "\n\n\t\t==============================================================";
	cout << "\n\n";
	cout << " press 1 for play \n press 2 for setting \n press 3 to exit the game";
	cin >> v;
	if (v == 1)
	{
		start();
	}
}
int start()
{
	int c,  n;
	char name[100];
		cout << "\n Please Enter Your Name : ";
	cin >> name ;
	cout << "\n\n";
	cout << "\n\n\t\t Welcome " << name << "\n";
	cout << "\n\n\t\t Loading Please wait........";
	cout << "\n\n\t\t 1) Start Quiz";
	cout << "\n\n\t\t 2) View Score";
		cout << "\n\n Enter Your Choice :--> ";
	cin >> n;
	if (n == 1)
	{
		cout << "select one category";
		cout << "\n 1)History\n 2)Science \n 3)Technology\n 4)Space";
        cout <<"\n 5)Entertainmenmt";
		cin >> c;
		if (c == 1)
		{
			history();
		}

	}
	return 0;
}
int history()
{
	int  x=0;
	char ans;
	rule();
	cin.get();
	cout << "\n\nIn which battle were tanks first used ?\n";
	cout << "A) Battle of Farance\nB) battle of Gallipolin\n";
	cout << "C) Battle of the Somme\nD) Battle of Stalingrad";
	cin >> ans ;
	if (ans == 'c')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout <<"\n\n Sorry Wrong Answare...."; 
			cin.get();
	cout << "\n\n\n";
	cout << "When was atomic bombs dropped on Nagasaki & Hiroshima?";
	cout << "\nA) 1946\nB) 1945\n";
	cout << "C) 1947\nD) 1948";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "What was the historic capital of the Inca Empire?";
	cout << "\nA)Vilcabamba\nB) Cusco\n";
	cout << "C) Pisac\nD) Vitcos";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "Which country did democracy begin in?";
	cout << "\nA) Greece\nB) China\n";
	cout << "C) Egypt\nD) France";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "What was the official language of the Pakistan?";
	cout << "\nA) Urdu\nB) Hindi\n";
	cout << "C) Punjabi\nD) English";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "When did WWII end?";
	cout << "\nA) 1949\nB) 1945\n";
	cout << "C) 1941\nD) 1950";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "Which of these is a fighter plane used by the British air force during World War II?";
	cout << "\nA) Blch MB-2000\nB) Stuka\n";
	cout << "C) Yakovlev Yak-1\nD) Spitfire";
	cin >> ans;
	if (ans == 'c')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "Adolf Hitler Grew up in which country?";
	cout << "\nA) Germany\nB) Spain\n";
	cout << "C) France\nD) Austria";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "When did the American Revolutionary war start?";
	cout << "\nA) 1775\nB) 1745\n";
	cout << "C) 1821\nD) 1699";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
	cout << "\n\n\n";
	cout << "Who was the first historian?";
	cout << "\nA) Pausanias\nB) Aristotle\n";
	cout << "C) Herodotus\nD) Socrates";
	cin >> ans;
	if (ans == 'c')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
		cin.get();
	cout << "\n\n\n";
	cout << "In 1962, from what country did Algeria gain independence?";
	cout << "\nA) France\nB) England\n";
	cout << "C) China\nD) Pakistan";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << "What was O stand for in NATO?";
	cout << "\nA) Original\nB) Ocean\n";
	cout << "C) Overseas\nD) Organization";
	cin >> ans;
	if (ans == 'd')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << "Who was the leader of spartans ate the battle of Thermopylae?";
	cout << "\nA) Herodotus\nB) Leonidas\n";
	cout << "C) pericles\nD) Solon";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << "Who was burnt at the stake in 1431 ?";
	cout << "\nA) William Sawtrey\nB) Geoge Wishart\n";
	cout << "C) Gerard Segarelli\nD) Joan of Arc";
	cin >> ans;
	if (ans == 'd')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << "What ancient civilization built the Sphinx?";
	cout << "\nA) Greek\nB) Mesopotamian\n";
	cout << "C) Mayan\nD) Egyptian";
	cin >> ans;
	if (ans == 'd')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	
	cin.get();
	cout << "\n\n\n";
	cout << "Whot was leader of germany in WW2?";
	cout << "\nA) B.mussolini\nB) A.Hitler\n";
	cout << "C) J.Goebbels\nD) B>H>Himmler";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << "What was the name of german leader during world war II?";
	cout << "\nA) Andela Merkel\nB) Adolf Hitler\n";
	cout << "C) Winston Churchill\nD) Konrad Adenauer";
	cin >> ans;
	if (ans == 'b')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare....";
	cin.get();
		cout << "\n\n\n";
	cout << "Which Famous explorer discovered Cuba?";
	cout << "\nA) Christopher Columbus\nB) Roald Amundsen\n";
	cout << "C) Vasco de Gama\nD) Marco Polo";
	cin >> ans;
	if (ans == 'a')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...."; 
	cin.get();
	cout << "\n\n\n";
	cout << " Which explorer traveled farthest?";
	cout << "\nA) R.Amundsen\nB) F.Magellan\n";
	cout << "C) N.Armstrong\nD) F.Drake";
	cin >> ans;
	if (ans == 'c')
	{
		x = x + 10;
		cout << " \n\ncorrect answer";
	}
	else cout << "\n\n Sorry Wrong Answare...." << endl;
	cout << "Yours Score " << x;
	return 0;
}
int rule()
{
	cout << "Games rules";
	cout <<"\n*Enter answer in the A,B,C and D only..."; 
	cout << "\n*Answer as fast as you can\n*You have 20 seconds to answer each question";
	cout << "\n*You have 3 lives\n*For 5 correct answers in a row you gain one life";
	return 0;
}

Comments

Popular posts from this blog

Multiple inheritance,friend function and multiple file in oop(object oriented programming)

Concepts of OOP (object oriented programming)

Concepts in c++........