#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
int ch;
class user
{
char ans,name[20],surname[20],user_id[20],password[20];
int marks;
public:
void start();
void details();
char* retuser_id()
{
return user_id;
}
char* retpassword()
{
return password;
}
};
void user::details()
{
clrscr();
textcolor(BLUE);
textbackground(CYAN);
cout<<"______________________________________NEW USER ID______________________________"<<endl<<endl;
for(int i=0;i<5;i++)
{
cout<<"*********************************************************************"<<endl;
}
cout<<" FIRST NAME :: ";
gets(name);
cout<<" LAST NAME :: ";
gets(surname);
cout<<" USER ID :: ";
gets(user_id);
cout<<" PASSWORD :: ";
gets(password);
cout<<endl;
for(i=0;i<5;i++)
{
cout<<"*****************************************************************************"<<endl<<endl;
}
}
void user::start()
{
textbackground(WHITE);
textcolor(RED);
clrscr();
cout<<endl;
cout<<setw(58)<<"DR.VIRENDRA SWARUP EDUCATION CENTRE"<<endl;
cout<<"________________________________________________________________________________";
cout<<"________________________________________________________________________________"<<endl;
cout<<endl;
cout<<setw(52)<<"COMPUTER SCIENCE PROJECT"<<endl;
cout<<setw(52)<<"________________________"<<endl;
cout<<endl<<endl<<endl;
cout<<"Made By-"<<endl;
cout<<"********"<<endl<<endl;
cout<<"Name-: Priyam Singh"<<endl;
cout<<"Class-: XI-A"<<endl;
cout<<"Roll.No-: 23"<<endl<<endl<<endl;
cout<<"________________________________________________________________________________";
cout<<"________________________________________________________________________________"<<endl;
cout<<setw(80)<<"NEXT PAGE(PRESS 1)"<<endl;
cin>>ch;
if(ch==1)
{
clrscr();
textbackground(RED);
textcolor(WHITE);
cout<<setw(72)<<"*********WELCOME TO THE QUIZ CONTEST........*********"<<endl;
cout<<"________________________________________________________________________________"<<endl;
cout<<"Rules of the games are as follows-"<<endl;
cout<<"................................................................................"<<endl;
cout<<endl;
cout<<"There are three rounds in the quiz"<<endl;
cout<<"1-Easy round"<<endl;
cout<<"2-Medium round"<<endl;
cout<<"3-Hard round"<<endl;
cout<<"* "<<"To enter the last round you have to complete the first two rounds"<<endl<<endl;
cout<<"* "<<"The easy round consists of 4 easy questions out of which you have to get 2 answers correct to enter the medium round"<<endl<<endl;
cout<<"* "<<"The medium round consists of 6 questions out of which you have to get 4 answers correct to enter the hard round"<<endl<<endl;
cout<<"* "<<"The hard round consists of 8 questions which is damn tough"<<endl<<endl;
cout<<"* "<<" Each hidden letter is represented by a underscore"<<endl<<endl;
cout<<"* "<<" You have to type only one letter in one try"<<endl<<endl;
cout<<"________________________________________________________________________________"<<endl;
//cout<<"SO LET'S BEGIN WITH THE GAME"<<endl<<endl<<endl<<endl;
cout<<setw(640)<<"NEXT PAGE(PRESS 2)"<<endl;
cin>>ch;
if(ch==2)
{
marks=0;
textbackground(CYAN);
textcolor(BLUE);
clrscr();
cout<<"------------------------------------------------------------------------------";
cout<<endl<<endl<<endl<<setw(50)<<"LETS BEGIN WITH THE FIRST ROUND"<<endl;
delay(2000);
cout<<"-------------------------------------------------------------------------------";
textbackground(WHITE);
textcolor(BLUE);
clrscr();
cout<<"--------------------------------------------------------------------------------";
cout<<"\n\n\n\n 1:- In which city currency of india is printed"<<endl;
cout<<"--------------------------------------------------------------------------------";
cout<<"\n\n\na)Delhi"<<endl;
cout<<"b)Nasik"<<endl;
cout<<"c)Noida"<<endl;
cout<<"d)Mumbai"<<endl;
cout<<"-------------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='b' || ans=='B')
{
delay(500);
cout<<endl<<setw(20)<<"Yeah!!You guessed it right"<<endl;
cout<<"-------------------------------------------------------------------------";
delay(2000);
marks++;
}
else
{
cout<<setw(20)<<"Oops!!You guessed it wrong"<<endl;
cout<<"-------------------------------------------------------------------------";
delay(2000);
}
textbackground(GREEN);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n2:- Science of diseases"<<endl<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Embryology"<<endl;
cout<<"b)Pyschology"<<endl;
cout<<"c)Pathology"<<endl;
cout<<"d)Orthopaedics"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='c'||ans=='C')
{
delay(500);
cout<<setw(50)<<"THAT'S THE RIGHT ANSWER"<<endl;
cout<<"-------------------------------------------------------------------------";
delay(2000);
marks++;
}
else
{
cout<<setw(50)<<"SORRY!! THAT'S NOT THE RIGHT ANSWER";
delay(2000);
}
textbackground(YELLOW);
textcolor(BLUE);
clrscr();
cout<<"\n\n\n\n\n3:- Taj Mahal is situated on the banks of which river?"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Yamuna"<<endl;
cout<<"b)Ganga"<<endl;
cout<<"c)Kaveri"<<endl;
cout<<"d)Koshi"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(50)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
cout<<"-------------------------------------------------------------------------";delay(2000);
marks++;
}
else
{
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
clrscr();
textbackground(CYAN);
textcolor(BLACK);
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n4:- The longest river on the earth is"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Amazon"<<endl;
cout<<"b)Nile"<<endl;
cout<<"c)Mekong"<<endl;
cout<<"d)Danube"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='b' || ans=='B')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
if(marks>=2)
{
textbackground(RED);
textcolor(WHITE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"RESULT OF FIRST ROUND:"<<endl<<endl;
cout<<setw(50)<<"Your marks are:-"<<marks<<endl;
cout<<endl<<endl;
cout<<"*******************************************************************************"<<endl;
cout<<setw(50)<<"CONGRATULATIONS!!!! YOU HAVE QUALIFIED THE FIRST ROUND"<<endl<<endl;
delay(2000);
}
else
{
textbackground(YELLOW);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n\n\n\n\n\n\nSorry you werte not able to Qualify the first round :("<<endl;
delay(1000);
cout<<"-------------------------------------------------------------------------";
cout<<"Try playing this round again :"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"Press any key to exit ";
exit(0);
}
textbackground(CYAN);
textcolor(RED);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"LET'S BEGIN WITH THE SECOND ROUND"<<endl;
delay(2000);
cout<<"-------------------------------------------------------------------------";
clrscr();
cout<<"\n\n\n\n1:- A flock of crows is known as ?"<<endl<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Quail"<<endl;
cout<<"b)Covey"<<endl;
cout<<"c)Murder"<<endl;
cout<<"d)Sallies"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='c' || ans=='C')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
delay(500);
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
delay(500);
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(WHITE);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n\n2:- Place where desert meets water"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Namibia"<<endl;
cout<<"b)Orisis"<<endl;
cout<<"c)Meeting point"<<endl;
cout<<"d)Desertwater"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
cout<<"-------------------------------------------------------------------------";
delay(500);
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(GREEN);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n3:- What are John Abraham and Akshay Kumar's professions in Garam Masala"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"\n\n\na)Dancers"<<endl;
cout<<"b)Salesmans"<<endl;
cout<<"c)Pilots"<<endl;
cout<<"d)Photographers"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='d' || ans=='D')
{
cout<<"-------------------------------------------------------------------------";
delay(500);
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(YELLOW);
textcolor(WHITE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n4:-Which is the fastest growing woody plant in the world?"<<endl<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Mango"<<endl;
cout<<"b)Bamboo"<<endl;
cout<<"c)Rosewood"<<endl;
cout<<"d)Coconut"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='b' || ans=='B')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(RED);
textcolor(WHITE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n5:- The language spoken by people of Pakistan is"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Sindhi"<<endl;
cout<<"b)Urdu"<<endl;
cout<<"c)Arabian"<<endl;
cout<<"d)Pakistani"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(YELLOW);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n6:- A cluster of banana is known as?"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\a)Hand"<<endl;
cout<<"b)Leg"<<endl;
cout<<"c)Donut"<<endl;
cout<<"d)Book"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(RED);
textcolor(WHITE);
clrscr();
if(marks>=6)
{
cout<<setw(50)<<"RESULT OF SECOND ROUND:"<<endl<<endl;
cout<<setw(50)<<"Your marks are:-"<<marks<<endl;
cout<<endl<<endl;
cout<<setw(50)<<"CONGRATULATIONS!!!! YOU HAVE QUALIFIED THE SECOND ROUND"<<endl<<endl;
delay(2000);
}
else
{
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n\n\n\n\n\n\nSorry you werte not able to Qualify the first round :("<<endl;
delay(1000);
cout<<"-------------------------------------------------------------------------";
cout<<"Try playing this round again :"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"Press any key to exit ";
exit(0);
}
textbackground(BROWN);
textcolor(GREEN);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<setw(30)<<"\n\n\n\nLET'S BEGIN WITH THE FINAL ROUND"<<endl;
delay(2000);
cout<<"-------------------------------------------------------------------------";
textbackground(GREEN);
textcolor(WHITE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n1:-This actress has been selected as jury member for the Cannas Film Festival in 2003"<<endl<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)Rani Mukherjee"<<endl;
cout<<"b)-Priti Zinta"<<endl;
cout<<"c)-Aishwaraya Rai"<<endl;
cout<<"d)-Priyanka Chopra"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='c' || ans=='C')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(WHITE);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n2:-The pleasant smell of earth after it has rained is called as?"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)-Petrichor"<<endl;
cout<<"b)-Perfume"<<endl;
cout<<"c)-Gallax"<<endl;
cout<<"d)-Stone"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(CYAN);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n3:-Science of treatment of bones is ?"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)-Clavicology"<<endl;
cout<<"b)-Craniology"<<endl;
cout<<"c)-Erythrology"<<endl;
cout<<"d)-Orthopaedics"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='d' || ans=='D')
{
delay(500);
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(WHITE);
textcolor(RED);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n4:-What is the fear of clowns called?"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)-Coulrophobia"<<endl;
cout<<"b)-Acrophobia"<<endl;
cout<<"c)-Sinophobia"<<endl;
cout<<"d)-Mektophobia"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(50)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(WHITE);
textcolor(BLUE);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n5:-Who is the author of novel Three Mistakes Of My Life"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)-Mark Twain"<<endl;
cout<<"b)-Chetan Bhagat"<<endl;
cout<<"c)-Stephen King"<<endl;
cout<<"d)-Virginia Woolf"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(50)<<"Your answer : ";
cin>>ans;
if(ans=='b' || ans=='B')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(CYAN);
textcolor(RED);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n6:- First movie submitted for Oscar:-"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\na)-Amrapali"<<endl;
cout<<"b)-Madhumati"<<endl;
cout<<"c)-The Guide"<<endl;
cout<<"d)-Mother India"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='d' || ans=='D')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(BROWN);
textcolor(YELLOW);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n7:-Film and Television Institute of India is locatec where?"<<endl;
cout<<"\n\n\na)-Mumbai"<<endl;
cout<<"b)-Pune"<<endl;
cout<<"c)-Delhi"<<endl;
cout<<"d)-Kolkata"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='b' || ans=='B')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
textbackground(BLUE);
textcolor(BLACK);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<"\n\n\n\n8:Which song was written in the memory of Late Paul Walker-"<<endl;
cout<<"\n\n\na)-See you again"<<endl;
cout<<"b)-Miss you my friend"<<endl;
cout<<"c)-Hope we will meet soon"<<endl;
cout<<"d)-Fetish"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<endl<<setw(20)<<"Your answer : ";
cin>>ans;
if(ans=='a' || ans=='A')
{
delay(500);
cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"Yeah!!You guessed it right"<<endl;
delay(2000);
marks++;
}
else
{ cout<<"-------------------------------------------------------------------------";
cout<<setw(50)<<"OOPS!! YOU GUESSED WRONG THIS TIME";
delay(2000);
}
if(marks>=12)
{
textbackground(BROWN);
textcolor(RED);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<setw(40)<<"RESULT OF FINAL ROUND:"<<endl<<endl;
cout<<setw(40)<<"Your marks are:-"<<marks<<endl;
cout<<endl<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<setw(40)<<"CONGRATULATIONS!!!! YOU HAVE QUALIFIED THE FINAL ROUND"<<endl<<endl;
cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
cout<<"-------------------------------------------------------------------------";
cout<<setw(40)<<"YOU WON THE GAME"<<endl;
delay(2000);
exit(0);
}
else
{ textbackground(BROWN);
textcolor(BLACK);
clrscr();
cout<<"-------------------------------------------------------------------------";
cout<<setw(40)<<"RESULT OF FIRST ROUND IS:"<<endl;
cout<<setw(40)<<"Your marks are :"<<marks<<endl;
cout<<endl<<endl<<endl;
cout<<"*********************************************************************************"<<endl;
cout<<setw(50)<<"SORRY!!! YOUR MARKS ARE NOT ENOUGH TO QUALIFY THE FIRST ROUND"<<endl;
cout<<endl<<endl<<endl;
cout<<setw(50)<<"BETTER LUCK NEXT TIME:)"<<endl;
delay(2000);
cout<<"-------------------------------------------------------------------------";
delay(3000);
cout<<setw(50)<<"Thanx for your interest"<<endl;
delay(2000);
exit(0);
}
}
}
}
void input()
{
clrscr();
textcolor(BLACK);
textbackground(BROWN);
user log;
fstream fout;
fout.open("LOGIN3.TXT",ios::app|ios::binary);
log.details();
fout.write((char*)& log,sizeof(log));
log.start();
fout.close();
}
void login()
{
textcolor(WHITE);
textbackground(GREEN);
clrscr();
user log;
fstream fin;
cout<<"____________________________________________________________________________"<<endl;
char username[20],password[20];
for(int i=0;i<5;i++)
{
cout<<"*********************************************************************"<<endl;
}
cout<<"LOGIN YOUR USER ID : ";
gets(username);
cout<<"LOGIN YOUR PASSWORD : ";
gets(password);
fin.open("LOGIN3.TXT",ios::in|ios::app|ios::binary);
if(!fin)
{
cout<<"No such file exists ";
exit(0);
}
else
while(!fin.eof())
{
fin.read((char*)&log,sizeof(log));
if((strcmpi(log.retuser_id(),username)==0)&&(strcmpi(log.retpassword(),password)==0))
{
log.start();
}
else
cout<<"Wrong userid and password"<<endl;
}
for(i=0;i<5;i++)
{
cout<<"*********************************************************************"<<endl;
}
fin.close();
}
void main()
{
textbackground(CYAN);
textcolor(BLUE);
clrscr();
cout<<":::::::::::::::::::::::::::::::::WELCOME TO THE QUIZ MANIA:::::::::::::::::::::::::::::"<<endl<<endl;
for(int i=0;i<5;i++)
{
cout<<"*********************************************************************"<<endl;
}
cout<<"1) New user"<<endl;
cout<<"2) Existing user"<<endl;
int choice;
cout<<"Enter your choice(1 or 2) ";
cin>>choice;
if(choice==1)
{
input();
}
else if(choice==2)
{
login();
}
else
cout<<"wrong choice";
for(i=0;i<5;i++)
{
cout<<"*********************************************************************"<<endl;
}
getch();
}
//Hope you will enjoy it //
0 comments:
Plz. comment