#include #include #include #include #include #include void display() { cout << "--------------------------------------------------------------------------------"; cout << "-------------------------------WORD GUESSING GAME-------------------------------"; cout << "--------------------------------------------------------------------------------"; cout << "\n\n Start Game"; cout << "\n\n How to Play"; cout << "\n\n Credits"; cout << "\n\n Quit"; gotoxy(22,25); cout<<"Press \'W\' to go up and \'S\' to go down"; gotoxy(29,24); cout<<"Press to select"; } struct coordinate { int x,y;}; struct level { char hint[5][11]; char answer[10]; }; void youwin(int points) { clrscr(); gotoxy(1,1); cout<<" .\n"; cout<<" J:L (\"\"\")\n"; cout<<" |:| III\n"; cout<<" |:| III\n"; cout<<" |:| III\n" ; cout<<" |:| __III__\n"; cout<<" |:| /:-.___,-:\\\n"; cout<<" |:| \\] |:| [/\n" ; cout<<" |:| |:|\n" ; cout<<" |:| |:|\n" ; cout<<" |:| |:|\n" ; cout<<"/] |:| [\\ |:|\n" ; cout<<"\\:-'\"\"\"`-:/ |:|\n" ; cout<<" \"\"III\"\" |:|\n"; cout<<" III |:|\n" ; cout<<" III |:|\n" ; cout<<" III |:|\n" ; cout<<" (___) J:F \n" ; cout<<" \"" ; gotoxy(35,8); cout<<"__ __ _ \n"; gotoxy(35,9); cout<<"\\ \\/ /___ __ __ _ __(_)___ \n"; gotoxy(35,10); cout<<" \\ / __ \\/ / / / | | /| / / / __ \\\n"; gotoxy(35,11); cout<<" / / /_/ / /_/ / | |/ |/ / / / / /\n"; gotoxy(35,12); cout<<"/_/\\____/\\__,_/ |__/|__/_/_/ /_/ \n"; gotoxy(43,15); cout<<"Your points are "<< points; } void prtchar(char x,int length) { for (int i = 1; i <=length; i++) { cout << x; } } void prtbox(coordinate &a,coordinate &b) { gotoxy(a.x,a.y); prtchar('-',((b.x)-(a.x)+1)); gotoxy(a.x,b.y); prtchar('-',((b.x)-(a.x)+1)); int x; for(x=((a.y)+1);x='a')&&(inp<='z'))||((inp>='A')&&(inp<='Z'))) { if(loopvar!=8) { input[loopvar]=inp; loopvar++; } } else if(inp=='-') //'-' for going back { break; } } clrscr(); return 0; } void startgame() { int select=1; char c; while(1) { gotoxy(28,1); cout<<" __ __ __"; gotoxy(28,2); cout<<"| | | | | | |"; gotoxy(28,3); cout<<"| |-- | | |-- | --"; gotoxy(28,4); cout<<"|__ |__ \\/ |__ |__ __|"; int x; coordinate a,b; for(x=1;x<10;x++) { gotoxy(((x*7)+2),8); cout< to select\n"; cout<<"Press \'-\' to go back\n"; cout<<"For each hint 20 points will be reduced"; cout<<"\n\nPRESS ANY KEY TO GO BACK"; getch(); } void credits() { int i=25; for(;i>=-8;i--) { clrscr(); if((i>0)&&(i<=25)) { gotoxy(37,i); cout<<"CREDITS"; } if(((i+3)>0)&&((i+3)<=25)) { gotoxy(34,(i+3)); cout<<"Deepak Prasad"; } if(((i+5)>0)&&((i+5)<=25)) { gotoxy(35,(i+5)); cout<<"Vikas Kumar"; } if(((i+7)>0)&&((i+7)<=25)) { gotoxy(30,(i+7)); cout<<"Abhishek Kumar Mahato"; } if(((i+9)>0)&&((i+9)<=25)) { gotoxy(35,(i+9)); cout<<"Sumit Kumar"; } delay(200); } } void quit() { clrscr(); retry: gotoxy(27,12); cout<<"Do you really want to quit?"; gotoxy(38,13); cout<<"Y/N"; char c; c= getch(); if((c=='y')||(c=='Y')) exit(0); else if(!((c=='n')||(c=='N'))) goto retry; } void main() { char c='w'; int selec=0; while(1) { clrscr(); display(); select(selec); c=getch(); if((c=='w')||(c=='W'))//up { if(selec!=0) selec--; } else if((c=='s')||(c=='S'))//down { if(selec!=3) selec++; } else if (c=='-') break; else if(c==13) //enter for selection(ASCII value 13) { clrscr(); if(selec==0) startgame(); else if(selec==1) howtoplay(); else if(selec==2) credits(); else if(selec==3) quit(); } } }