Professional Documents
Culture Documents
Kendrya Vidalaya No. 2 Delhi Cantt. New Delhi, Ii-Shift: Submitted As A Part of C.B.S.E. Curriculum FOR THE YEAR 2018-19
Kendrya Vidalaya No. 2 Delhi Cantt. New Delhi, Ii-Shift: Submitted As A Part of C.B.S.E. Curriculum FOR THE YEAR 2018-19
Kendrya Vidalaya No. 2 Delhi Cantt. New Delhi, Ii-Shift: Submitted As A Part of C.B.S.E. Curriculum FOR THE YEAR 2018-19
2
Delhi Cantt.
New Delhi , ii-Shift
Submitted To:
Mrs. Neelam Gupta
PGT(Computer Science)
Submitted By:
Prabhat Kumar Mishra
roll no:9175064
COMPUTER SCIENCE
PROJECT FILE
Language-C++
TABLE OF CONTENTS
Certificate.
Acknowledgement.
Coding.
Screenshots.
Bibliography.
Certificate
This is to certify that Prabhat Kumar Mishra
of class twelve, KV No.2 Delhi Cantt, New Delhi has
successfully completed his project in computer
practicals for the AISSCE as prescribed by CBSE in
the year 2018-2019.
Date :
Registration No. :
__________________ __________________
Acknowledgement
I thank my Computer Science teacher Mrs.
Neelam Gupta for guidance and support. I would
also like to thank my parents and my friends for
encouraging me during the course of this project.
Finally I would like to thank CBSE for giving me
this opportunity to undertake this project.
HEADER FILES USED
GRAPHICS.H- initgraph();
setbkcolor();
setcolor();
settextstyle();
outtextxy();
circle(); rectangle(); line();
PROCESS.H- exit();
FSTREAM.H- read(),write(),open(),close();
CONIO.H- getch();
STDLIB.H- rand();
STRING.H- strcpy();
DOS.H- delay();
CODING:
//HEADER FILES USED IN PROGRAM:
#include<fstream.h>
#include<graphics.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
//*******************************************************
****************************
//*******************************************************
****************************
//*******************************************************
****************************
void swap(char &a,char&b) //function for swapping values
{
char c=a;
a=b;
b=c;
}
//*******************************************************
****************************
//*******************************************************
****************************
gotoxy(1,10);
cout<<"\nPLAYER NAME\t\tSCORE\n\n";
for(int i=0;i<10;++i)
{
fin.read((char*)&o,sizeof(o));
cout<<i+1<<">> "<<o.word<<"\t\t\t"<<o.i<<"\n";
}
fin.close();
getch();
}
//*******************************************************
****************************
word o;
ifstream fin;
char plname[25],rearanged[15],ans[15];
int score,lev,i;
randomize();
setfillstyle(2,RED);
bar(0,0,getmaxx(),getmaxy());
setcolor(YELLOW);
circle5(getmaxx()/2,getmaxy()/5+100,105);
setcolor(GREEN);
circle5(getmaxx()/2,getmaxy()/5+100,110);
setcolor(CYAN);
circle5(getmaxx()/2,getmaxy()/5+100,115);
textcolor(BLUE);
{ //wellcome screen output TEXT
gotoxy(32,10);
settextstyle(3,0,3);
cout<<"KV NO.2 DELHI CANTT";
gotoxy(34,11);
cout<<"NEW DELHI-110010";
gotoxy(35,13);
cout<<" C++ project ";
gotoxy(39,14);
cout<<" On ";
gotoxy(32,16);
cout<<"WORD GUESSING GAME";
gotoxy(1,26);
cout<<"\n\n\n\n\nCreated By:";
cout<<"Prabhat Kumar Mishra\n";
cout<<"\t\t\t&\n";
cout<<"\t\t\t\Rohan Yadav";
cout<<"\nSubmitted to:";
cout<<"Mrs.Neelam Gupta";
cout<<"\n\n\t\t\t Press any key to continue ...";
}
getch();
main:
load();
setbkcolor(BLACK);
int no=random(10);
clr();
score=0;lev=1;
setcolor(GREEN); //for creating circle OUTSIDE THE
MENU
circle5(getmaxx()/2,getmaxy()/2,195);
setcolor(YELLOW);
circle5(getmaxx()/2,getmaxy()/2,200);
setcolor(RED);
circle5(getmaxx()/2,getmaxy()/2,205);
gotoxy(25,12);
settextstyle(3,0,5);
cout<<"GAME MENU:\n\n"; //TEXT for menue.
gotoxy(26,14);
cout<<"Enter Options";
gotoxy(26,16);
cout<<"1>> To start game:\n";
gotoxy(26,17);
cout<<"2>> To view high scores:";
gotoxy(26,18);
cout<<"3>> To view info:";
gotoxy(26,19);
cout<<"4>> To EXIT : ";
gotoxy(28,21);
cout<<"Your choice: ";
int choice;
cin>>choice;
switch(choice)
{
case 1: //case 1 for playing game
{
game:
load2();
clr();
setbkcolor(BLACK);
gotoxy(2,2);
textcolor(BLACK);
cout<<"\n\n\n\t\t\t\tEnter your NAME : ";
cin>>plname;
clr(); // level one
gotoxy(35,15);
cout<<"LEVEL 1";
delay(2600);
clr();
fin.open("lev1.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(BLACK);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 2
gotoxy(30,15);
cout<<"LEVEL 2";
delay(3000);
clr();
fin.open("lev2.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 3
gotoxy(30,15);
cout<<"LEVEL 3";
delay(2600);
clr();
fin.open("lev3.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 4
gotoxy(30,15);
cout<<"LEVEL 4";
delay(2600);
clr();
fin.open("lev4.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); // level 5
gotoxy(30,15);
cout<<"LEVEL 5";
delay(2600);
clr();
fin.open("lev5.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 6
gotoxy(30,15);
cout<<"LEVEL 6";
delay(2600);
clr();
fin.open("lev6.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); // level 7
gotoxy(30,15);
cout<<"LEVEL 7";
delay(2600);
clr();
fin.open("lev7.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 8
gotoxy(30,15);
cout<<"LEVEL 8";
delay(2600);
clr();
fin.open("lev8.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
clr(); //level 9
gotoxy(30,15);
cout<<"LEVEL 9";
delay(2600);
clr();
fin.open("lev9.txt");
for(i=0;i<=no;++i)
fin.read((char *)&o,sizeof(o));
fin.close();
strcpy(rearanged,o.word);
rearr(rearanged,lev+2);
disp(plname,score,lev,rearanged);
cin>>ans;
if(strcmp(ans,o.word)!=0)
{textcolor(WHITE);
gotoxy(32,25);
cout<<"WRONG";
gotoxy(32,26);
cout<<"Correct word is :-";
gotoxy(32,27);
cout<<o.word;
delay(2600);
goto end;
}
gotoxy(32,25);
cout<<"CORRECT";
delay(2600);
score+=lev*5;
++lev;
end:
{
clr();
gotoxy(1,1);
opt:
cout<<"Want to play again(y/n): ";
char ch;
cin>>ch;
{ if(ch=='y'||ch=='Y')
goto game;
else if(ch=='n'||ch=='n')
goto main;
else
cout<<"Oops wrong option,Please type correct
one\n";
goto opt; }
}
opt2:
cout<<"Want to play the game(y/n): ";
char ch;
cin>>ch;
{ if(ch=='y'||ch=='Y')
goto game;
else if(ch=='n'||ch=='n')
goto main;
else
cout<<"Oops wrong option,Please type correct
one\n";
goto opt2; }
}
opt3:
cout<<"\n\n Return to main menu or exit? (y/n): ";
char ch;
cin>>ch;
{ if(ch=='y'||ch=='Y')
goto main;
else if(ch=='n'||ch=='n')
exit(0);
else
cout<<"Oops wrong option,Please type correct one\n\n";
goto opt3; }
}
case 4:
{
thanknote();
delay(20000);
exit(0);
}
}
getch();
}
//*******************************************************
****************************
//*******************************************************
****************************
//*******************************************************
****************************
//*******************************************************
****************************
//*******************************************************
****************************
void thanknote() //function for thanking the user for using this
game
{
clr();
setbkcolor(GREEN);
gotoxy(1,1);
cout<<"\n\n\n\n\n\
THANK YOU for using this program.\n\
--Created by:\n\
Prabhat Kumar Mishra\n\
XII th ";
}
//*******************************************************
****************************
for(i=35;i<555;i++)
{
setcolor(GREEN); //** this is for green filling in the
loading bar.
line(25+i,170,25+i,200); //** this is for increasing the size of
green bar.
delay(5);
//*******************************************************
****************************
for(i=35;i<300;i++)
{
setcolor(YELLOW); //** this is for yellow filling in the
loading bar.
line(25+i,170,25+i,200); //** this is for increasing the size of
yellow bar.
delay(5);
//*******************************************************
****************************
/*END OF CODING*/
//*******************************************************
****************************
SCREENSHOTS
WELLCOME SCREEN:
LOADING SCREEN:
game menu:
LEVEL 1 SCREEN:
Level 2 screen:
LEVEL 3 SCREEN:
E. Balagurusami – C++.
Google.