GAME PROGRAMMING BY JOTHI... ~Fantastic Platform To Prove Intelligence!!! ~Here Its About Playinggames Using Programming Languages that are build by JOTHI,VIJI mam,Josephine Miss... Programming Languages Includes., 1.C -BASIC Programming Language 2.C++ -Object Oriented Programming Language 3.CG -Computer Graphics 4.Java -Object Oriented & Platform Independent Language 5.HTML -Hyper Text Markup Language Jothi Implemented Some Specialised Sourcecodes On basis of theories & games using C,CG,C++,JAVA,JAVASCRIPT,HTML.. _________________________ NVOK GAME USING C,C++,CG _________________________ #include #include #include #include int flag=0,top=0; void main(void) { clrscr(); int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,p,S,l,w,c,x,y,J,O,U,k; char n[30],P[30],q,opt,b[10]; cout<<"\n Jothi's Neengalum Vellalaam Oru Kodi\a\a\a\a\a\a\a"; cout<<"\n ****************************"; textbackground(BLACK); textcolor(CYAN); clrscr(); textcolor(WHITE+BLINK); cprintf("\b\n WELCOME TO Jothi in Neengalum Vellalaam Oru Kodi "); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--* "); textcolor(MAGENTA); cprintf("\b\n WE WANT SOME INFORMATION ABOUT YOU BEFORE PLAYING JNVOK"); cout<<"\n\n\a YOUR SWEET NAME : "; gets(n); cout<<"\n\n\a YOUR CURRENT LIVING PLACE(STATE) : "; gets(P); cout<<"\n\n\a GENDER MALE(1)\FEMALE(2) : "; cin>>S; textcolor(GREEN); textbackground(BLACK); clrscr(); textcolor(WHITE+BLINK); cprintf("\b\n Welcome To Neengalum Vellalaam Oru Kodi "); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--*--*--*--*--*--*--*--*--* "); if (S==1) cout<<"\nParabarapu Mika Naalaaga Indru Iruka Iraivanai Vaendi Kolvom\nVanakam To All\""<>q; if (q=='y'||q=='Y') { cout<<"\n These Are Ur Life Lines:"; cout<<" (1) AUDIANCE POLL"; cout<<" (2) FIFTY-FIFTY"; cout<<"\n PRESS (1) OR (2) : "; cin>>l; if (l==1) { cout<<"\n WRITE ANSWER IS : ELECTRIC BULB "; top++; } if (l==2) { cout<<"\n FIFTY-FIFTY : CAR BATTERIE/ELECTRIC BULB "; flag++; } cout<<"\n GIVE ANSWER : "; } else cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD SO AS TO WIN Rs. 1,000 : "); cin>>a1; switch(a1) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : delay(150); cout<<" YOU ARE RIGHT\a"; break; case 4 : cout<<" YOU ARE WRONG"; break; } if(a1==3) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf("\b\n WELCOME TO JNVOK"); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--*--*"); cout<<"\n\n\nCONGRATULATION YOU HAVE WON Rs. 1000"; cout<<"\n NOW COME TO THE NEXT QUESTION\n"; cout<<" QUESTION NO. 2\n"; textcolor(YELLOW); cprintf(" (Q) WHO WAS THE SEVENTH PRIME MINISTER OF INDIA ? "); cout<<"\n YOUR OPTIONS ARE :\n\a"; textcolor(MAGENTA); cprintf("\b(1) INDIRA GANDHI\n"); cprintf("\b(2) RAJIB GANDHI\n"); cprintf("\b(3) V.P.SINGH\n"); cprintf("\b(4) CHANDRA SHEKHAR\n"); textcolor(CYAN); cout<<"\n\bU had 2 Lifelines\n But,now u have 1ly one&our condition is that to ur 2nd Trial also u have to use a LIFELINE cumpulsarily!!!\n We r really helpless&now are u ready? : "; cout<<"\n IF YOU WANT TO USE IT PRESS \"Y\" ELSE \"N\""; cin>>q; if (q=='y'||q=='Y') { if(flag==0&&top==0) { cout<<"\n These Are Your Lifelines:"; cout<<" (1) Audiance Poll"; cout<<" (2) FIFTY-FIFTY"; cout<<"\n PRESS (1) OR (2) : "; cin>>l; if (l==1) { cout<<"\n WRITE ANSWER IS : RAJIB GANDHI "; top++; } if (l==2) { cout<<"\n FIFTY-FIFTY : INDIRA GANDHI/RAJIB GANDHI"; } } else if(top>1) { cout<<"\n\nyou have only one lifeline left i.e. Audiance Poll"; cout<<"\ndo you want to use it"; cin>>opt; if(opt=='y'||opt=='Y') { cout<<"\n RIGHT ANSWER IS RAJIB GANDHI"; } } else if(flag==1) { cout<<"\n\nyou have only one lifeline left i.e. fifty fifty"; cout<<"\ndo you want to use it"; cin>>opt; if(opt=='y'||opt=='Y') { cout<<"\n INDIRA GANDHI/RAJIB GANDHI";; } cout<<"\n GIVE ANSWER : "; } else cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD To Win Rs. 2,000 : "); cin>>a2; switch(a2) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : delay(150); cout<<" YOU ARE RIGHT \a"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 1000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a2==2) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf("\b\n WELCOME TO JNVOK"); textcolor(BROWN); cprintf("\b\n*--*--*--*--*--*--*"); cout<<"\n\n\nU r really lucky!!!\n U Sucessfully passed 2 hurdles u had,to Win 1Crore"; cout<<"\n ur game is superb&Shall we Move on!!!\n"; cout<<" QUESTION NO. 3\n"; textcolor(YELLOW); cprintf("(Q) WHO WON THE THIRD CRICKET WORLD CUP ? "); cout<<"\n your options are :\n\a"; textcolor(MAGENTA); cprintf("\b(1) INDIA\n"); cprintf("\b(2) WEST INDIES\n"); cprintf("\b(3) AUSTRALIA\n"); cprintf("\b(4) ENGLAND\n"); textcolor(CYAN); cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD to win Rs. 4,000 : "); cin>>a3; switch(a3) { case 1 : delay(150); cout<<" YOU ARE RIGHT \a"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 2000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a3==1) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK"); textcolor(BROWN); cprintf("\b\n*--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n we are playing Nice\n Thodar vetri!!!\n Come Lets Move on\n"; cout<<" QUESTION NO. 4\n"; textcolor(YELLOW); cprintf(" (Q) WHICH OF THE FOLLOWING THING USED TO MAKE JEWELLARY ? ");//U UTTRANCHAL HAS BEEN COME FROM WHICH STATE ? "); cout<<"\n your Options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) MICA\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) GARNET\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) NICKEL\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) BRONZE\n"); textcolor(CYAN); cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD TO WIN Rs. 5,000 : "); cin>>a4; switch(a4) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : delay(150); cout<<" YOU ARE RIGHT \a"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 4000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a4==2) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK"); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n Again Playing NICE\n Its raising Curiosity!!! ,\n Anyway Congrats!!!\n Shall we move on?"; cout<<"\n Look at your COMPUTER SCREEN now\n"; cout<<" QUESTION NO. 5\n"; textcolor(YELLOW); cprintf(" (Q) WHICH OF THE HERO HAS SIRNAME \"SRIVASTAVA\" "); cprintf("\n\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b BUT HE DON'T USE AFTER HIS NAME ? "); cout<<"\n Your options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) DILIP KUMAR\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) AMITAB BACHCHAN\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) DHARMENDRA\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) RAJ KUMAR\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 10,000 : "); cin>>a5; cout<<" Our Game needs a break i hope!!!\n We'll be right back after a short Commercial break!!\n SO DON'T GO AWAY\a "; cout<<"\n\n press \"0\" & \"enter\" "; cin>>c; if (c==0) goto h; h: textcolor(BROWN); clrscr(); cout<<"\n\n \"Jothi's Neengalum Vellalaam Oru Kodi\" co Sponsored by.,:"; textcolor(CYAN); cprintf(" \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\a\n\n NIRMA WASHING POWDER superb washing powder \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\a\a\n\n indu iravu 9.30 ku ungal SunTv il \a\"Chellamae\" \a\n\n\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b GEL pen romba mosam!!epavum enaku pidichathu.,INK pen \a"); cout<<"\n\n press \"0\" & \"enter\" "; cin>>x; if (x==0) goto v; v: textcolor(MAGENTA); clrscr(); if (S==1) cout<<" Welcome to JNVOK \n please take ur seat "<>y; if (y==0) goto g; g: switch(a5) { // textcolor(MAGENTA); // clrscr(); case 1 : cout<<" OH!u are out "; break; case 2 :delay(150); cout<<" YOU ARE RIGHT\a\a"; break; case 3 : cout<<" OH!wrong"; break; case 4 : cout<<" OH!wrong"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 5000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(ans5==2) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--* "); cout<<"\n\n\n Arumayaana Aatam\n what is yr secret of sucess?\n it is everyones Qn now...Anyway,lets go back to game"; cout<<"\n to test ur capability some qns are altered.,lets see how u r overcoming them!!!\n"; cout<<" QUESTION NO. 6\n"; textcolor(YELLOW); cprintf(" (Q) WHICH DAY IS CELEBRATE ON 5TH SEPTEMBER ?"); cout<<"\n your options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) ROSE DAY\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) VALENTIENS DAY\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) TEACHERS DAY\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) CHILDRENS DAY\n"); textcolor(CYAN); cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD TO WIN Rs. 20,000 : "); cin>>a6; switch(a6) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<" YOU ARE RIGHT \a"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 10000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a6==3) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n Lets go back to our Challenge!!"; cout<<"\n There we are with next Qn on ur COMPUTER SCREEN\n"; cout<<" QUESTION NO. 7\n"; textcolor(YELLOW); cprintf(" (Q) IN WHICH BANK OF INDIA PEOPLE COULD NOT OPEN THEIR ACCOUNT ? "); cout<<"\n your options are\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) S.B.I.\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) AMERICAN EXPRESS\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) CITI BANK\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) R.B.I.\n"); textcolor(CYAN); cprintf("\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD to win Rs. 40,000 : "); cin>>a7; switch(a7) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE RIGHT\a"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 20000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a7==4) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n CONGRATULATION YOU HAVE WON Rs. 40,000"; cout<<"\n NOW COME TO THE NEXT QUESTION\n"; cout<<" QUESTION NO. 8\n"; textcolor(YELLOW); cprintf(" (Q) IN WHICH GAME BLACK BALL IS USE ?"); cout<<"\n YOUR OPTIONS ARE :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) BILLIARD\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) POLO\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) TABLE TENNIS\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) FOOTBALL\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 80,000 : "); cin>>a8; switch(a8) { case 1 : cout<<" YOU ARE RIGHT \a"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<"YOU ARE RIGHT \a"; break; case 4 : cout<<" YOU ARE WRONG\a\a"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 40000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(ans8==1) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n Fantabulous brought up!!!\n Expectations raising!!!"; cout<<"\n our next Qn on ur COMPUTER SCREEN \n"; cout<<" QUESTION NO. 9\n"; textcolor(YELLOW); cprintf(" (Q) MOHALI IS SITUATED IN WHICH STATE ? "); cout<<"\n Ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) U.P.\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) MAHARASTRA\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) PUNJAB\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) RAJASHTHAN\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 1,60,000 : "); cin>>a9; switch(a9) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<" YOU ARE RIGHT \a"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 80000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(ans9==3) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n Nice Game\n we are very close to 1Crore,\n we hope u have many possibilities to win!!!"; cout<<"\n Next Qn on ur COMPUTER SCREEN\n"; cout<<" QUESTION NO. 10\n"; textcolor(YELLOW); cprintf(" (Q) WHICH OF FOLLWING PLACE IS KNOWN AS \"QUEEN OF HILLS\" ? "); cout<<"\n ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\b (1) NAINITAL\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\b (2) MOSSOURIE\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\b (3) OOTY\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\bb\b\b\b\b\b\b\b\b\b (4) DARGEELING\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 3,20,000 : "); cin>>a10; switch(a10) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE RIGHT \a"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 160000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(ans10==2) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK"); textcolor(YELLOW); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<" QUESTION NO. 11\n"; textcolor(YELLOW); cprintf(" (Q) When did india got independence???"); cout<<"\n ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) Jan 1\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) Aug 43\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) jan 26\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) Aug15\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 6,40,000 : "); cin>>a11; switch(a11) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG\a"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE RIGHT \a"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 320000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(ans11==4) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n\n we are on Finals.....\n"; cout<<" Ungal vaazhkayai maatra pogum antha oru kadaisi Qn itho ungal Computer Screen la!!!!\n"; cout<<" QUESTION NO. 12\n"; textcolor(YELLOW); cprintf(" (Q) IN WHICH YEAR RABINDRANATH TAGORE'S GITANJALI WAS "); cprintf("\n\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b FIRST PUBLISHED IN ENGLISH ?"); cout<<"\n Ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) 1910\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) 1911\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) 1912\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) 1913\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 12,50,000 : "); cin>>a12; cout<<" We respect ur patience!!!\n Surely we need a break!!!\n SO DON'T GO AWAY WE WILL BE BACK SOON\a "; cout<<"\n\n press \"0\" & \"enter\" "; cin>>J; if (J==0) goto N; N: textcolor(BROWN); clrscr(); cout<<"\n\n \"JNVOK\" Co sponsored by :"; textcolor(CYAN); cprintf(" \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\a\n\n Nerungi varavaa.,nerungi varuvaaai.,nerungi varuvaayae!!!!!\a\a\n\n\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b **** Brand Corporation Presents superb H/w parts!! \a\n\n\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b Ink pen is good than Gel pen!!! "); cout<<"\n\n press \"0\" & \"enter\" "; cin>>O; if (O==0) goto P; P: textcolor(MAGENTA); clrscr(); if (S==1) cout<<" Welcome to JNVOK \n We are back\n Take ur seat "<>U; if (U==0) goto i; i: switch(a12) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG,sorry YOU ARE RIGHT"; break; case 3 : cout<<" YOU ARE RIGHT \a "; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 640000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a12==3) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(YELLOW); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n We are onto newxt level Challenge!!!!\n"; cout<<" QUESTION NO. 13\n"; textcolor(YELLOW); cprintf(" (Q) WHAT IS THE VALUE OF (A-X)(B-X)(C-X)....(Z-X) ?"); cout<<"\n ur options are:\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) 0\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) 1\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) (ABCD...)(AX-X)\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) OTHER\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 25,00,000 : "); cin>>a13; switch(a13) { case 1 : cout<<" YOU ARE RIGHT\a"; break; case 2 : cout<<" YOU ARE WRONG "; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE WRONG"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 1250000\n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a13==1) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK"); textcolor(YELLOW); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<"\n\n still u played well!!!\n but this Qn seems to be tough!!\n let us see how u face it!!!"; cout<<"\n ur final Qn on ur COMPUTER SCREEN\n"; cout<<" QUESTION NO. 14\n"; textcolor(YELLOW); cprintf(" (Q) IN WHICH CITY JRD TATA SPORT COMPLEX LOCATED ? "); cout<<"\n ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) KOLKATA\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) KANPUR\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) MUMBAI\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) JAMSHEDPUR\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 50,00,000 : "); cin>>a14; switch(a14) { case 1 : cout<<" YOU ARE WRONG"; break; case 2 : cout<<" YOU ARE WRONG"; break; case 3 : cout<<" YOU ARE WRONG"; break; case 4 : cout<<" YOU ARE RIGHT \a"; break; } cout<<"\n WE ARE GIVING MANY MANY CONGRATULATION TO YOU\n FOR WINNING RS. 2500000 \n GOVERNMENT WILL CUT 100% TAX\n SO, SORRY WE CAN'T GIVE YOU ANY MONEY"; } if(a14==4) { textcolor(GREEN); clrscr(); textcolor(WHITE + BLINK); cprintf(" WELCOME TO JNVOK "); textcolor(BROWN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n *--*--*--*--*--*--*--*--*--*--*--* "); cout<<" DANGEROUS QUESTION NO. 15\n"; textcolor(YELLOW); cprintf(" (Q)WHO WAS THE FIRST WOMAN TO CROSS ENGLISH CHANNEL ? "); cout<<"\n ur options are :\n\a"; textcolor(MAGENTA); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (1) ARPITA CHATTERJEE\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (2) SOBHA GANGULY\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (3) AARTI SAHA\n"); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b (4) ROMA MUKHERJEE\n"); textcolor(CYAN); cprintf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n PRESS THE CORRECT BUTTON OF YOUR KEYBOARD FOR Rs. 1,00,00,000 : "); cin>>a15; textbackground(RED); textcolor(WHITE+BLINK); cout<<" "< Neengalum Vellalaam Oru Kodi
Welcome To NVOK By Jothi

1)Which is platform independent language

2)Which is class of all class in java

3)Frame package is in which package

4)Java does not support

_____________________________________________________ NVOK GAME USING C ____________________________________________________ #include #include void question1(); void main() { clrscr(); printf("\n\n\t\t Welcome to Neengalum Vellalaam Oru Kodi"); printf("\n\n\t\t*__*__*__*__*__*__*__*__*__*__*__*__*__*"); getch(); question1(); getch(); } char a,A,b,B,c,C,d,D,ans; void question2(); void question1() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); printf("The Answer may be",ans); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.1000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question2(); } } void question3(); void question2() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.2000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question3(); } } void question4(); void question3() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.5000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question3(); } } void question5(); void question4() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.10000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question4(); } } void question6(); void question5() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.50000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question5(); } } void question7(); void question6() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.100000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question6(); } } void question8(); void question7() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.250000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question7(); } } void question9(); void question8() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.500000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question8(); } } void question10(); void question9() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.750000"); break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question9(); } } void question11(); void question10() { clrscr(); printf("\n\b Q1.Who is called the father of History????\n"); printf("\n\t A.Herodotus\tB.Hero"); printf("\n\t C.Jothi \tD.Vinoth\n"); scanf("%c",&ans); switch(ans) { case'b': case'B': case'c': case'C': case'd': case'D': printf("\n\n Wrong Answer"); break; case'a': case'A': printf("\n\nYou Won RS.10000000"); print("\n\n YOU ARE THE NVOK CHAMPION!!!") break; default: printf("\n\nImproper Answer!!!Sorry,You Lose The Game"); } if((ans=='a')||(ans=='A')) { getch(); clrscr(); question10(); } } gotoxy(30,8); printf("Congrats,U won!!"); } } for time being i made all Questions and options to be the same and the Ans is Herodotus _______________________________________________________________ /********~Jothi's NVOK in C++ Using no CG~********/ _________________________________________________________________ #include #include void main(void) { char name[50],ques[11]; int s; clrscr(); do { s=0; cout<<"\n Welcome to NVOK!"; cout<<"\n Enter ur Name"; cin>>name; cout<<"\n Enter answer in form of 'a','b',and 'c' only"; cout<<"\n Q1.Who is Called the Father of History?"; cout<<"\n a.Herodotus"; cout<<"\n b.Jothi"; cout<<"\n c.Vinoth"; cin>>ques[1]; if(ques[1]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[2]; if(ques[2]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[3]; if(ques[3]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[4]; if(ques[4]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[5]; if(ques[5]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[6]; if(ques[6]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[7]; if(ques[7]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[8]; if(ques[8]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[9]; if(ques[9]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[10]; if(ques[10]='a') { s=s+1; cout<<"\n Good job!!"; cout<<"\n Your Score is:"<>ques[11]; } while(ques[11]=='y'||ques[11]=='Y'); getch(); } for time being i made all Questions and options to be the same and the Ans is Herodotus ********************************************************************************* Here is a SNAKE game programming Using C++ Language & Without Computer Graphics ********************************************************************************* #include #include #include char a[25][25]; int q1=24,q2=4,t1,t2,c1=0; int li=3,sc=0; char c; typedef struct snake *position; struct snake { int r,c; int *add; position next; }; position first,last,temp,t; void move(); void eat(); void definition(); void movement(char c); void memory(); void memory() { first=position(malloc(sizeof(struct snake))); first->r=q1; first->c=q2; first->next=NULL; } void definition() { memory(); temp=first; last=first; for(int i=0;i<25;i++) for(int j=0;j<25;j++) {if((i<23&&i>1)&&(j<23&&j>1))//&&(i%2!=0)&&(j%2!=0)) { a[i][j]='.'; c1++; } else a[i][j]=32; } a[q1][q2]='#'; for(i=5;i<20;i++) for(j=5;j<20;j++) if((i%2==0)&&(j%2==0)) a[i][j]='*'; } void move() { memory(); temp->next=first; temp=first; t=last->next; a[last->r][last->c]=32; free(last); last=t; } void eat() { memory(); temp->next=first; temp=first; } void main() { clrscr(); definition(); while(1) { clrscr(); cout<<"\n\t\tSnake Game\n\tLife="<=0)) { if(a[q1][q2-1]=='.') { sc++; eat(); } else move(); a[q1][--q2]='#'; } else li--; } if(c=='6') { if(((a[q1][q2+1]==32)||(a[q1][q2+1]=='.'))&&(q2+1<=24)) { if(a[q1][q2+1]=='.') { sc++; eat(); } else move(); a[q1][++q2]='#'; } else li--; } if(c=='8') { if(((a[q1-1][q2]==32)||(a[q1-1][q2]=='.'))&&(q1-1>=0)) { if(a[q1-1][q2]=='.') { sc++; eat(); } else move(); a[--q1][q2]='#'; } else li--; } if(c=='2') { if(((a[q1+1][q2]==32)||(a[q1+1][q2]=='.'))&&(q1+1<=24)) { if(a[q1+1][q2]=='.') { sc++; eat(); } else move(); a[++q1][q2]='#'; } else li--; } } } HTML FORM VALIDATION PROGRAM _______________________________ Simple Validation

Simple Validation


Enter your age: HTML FORMATTING TEXT PROGRAM _______________________________

This text is bold

This text is big

This text is italic

This is computer output

This is subscript and superscript

VERIFY PASSWORD PROGRAM ________________________ event clicking
PASSWORD:                             


CONFIRM PASSWORD            


   
PALINDROME PROGRAM _____________________ Enter a String/Number:
OPTIONAL SELECTION PROGRAM __________________________
CHESS GAME __________ #include #include #include #include char pattern[]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; #define PAWN 0 #define KNIGHT 1 #define BISHOP 2 #define ROOK 3 #define QUEEN 4 #define KING 5 #define EMPTY 6 #define WHITE 15 #define BLACK 0 #define VALUE_PAWN 100 #define VALUE_KNIGHT 300 #define VALUE_BISHOP 300 #define VALUE_ROOK 500 #define VALUE_QUEEN 900 #define VALUE_KING 10000 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$ $$$$ MOVE TYPES $$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $*/ #define MOVE_TYPE_NONE 0 #define MOVE_TYPE_NORMAL 1 #define MOVE_TYPE_CASTLE 2 #define MOVE_TYPE_ENPASANT 3 #define MOVE_TYPE_PROMOTION_TO_QUEEN 4 #define MOVE_TYPE_PROMOTION_TO_ROOK 5 #define MOVE_TYPE_PROMOTION_TO_BISHOP 6 #define MOVE_TYPE_PROMOTION_TO_KNIGHT 7 #define MATE 10000 /* losing King==mate */ #define column(pos) pos%8 #define row(pos) pos/8 //======================================================================== union REGS i,o; //for hardware interaction //============================pieces representation=========================== /* Board representation */ int piece[64] = { ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK }; int color[64] = { BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE }; //======================================================================== int player; /* whose turn? BLACK or WHITE */ char check,rookwm='f',kingwm='f',castlew='f'; typedef struct move { //move information int from, dest, type; } MOVE; /* For storing all moves of game */ typedef struct history { //history. MOVE m; int cap; } HIST; HIST hist[3000]; /* length of game < 3000 */ int moveorder; /* Current move order */ /* For searching */ int nodes; /* Count all visited nodes when searching*/ int ply; /* ply of search */ /*************************************************************************** * Utilities And Various Drawing Routines For Pieces. * ****************************************************************************/ void pawndraw(int px,int py,int c1) //Drawing A Pawn { int pos[8][2]; pos[0][0]=px+18; pos[0][1]=py+6; pos[1][0]=px+18; pos[1][1]=py+31; pos[2][0]=px+6; pos[2][1]=py+31; pos[3][0]=px+6; pos[3][1]=py+43; pos[4][0]=px+43; pos[4][1]=py+43; pos[5][0]=px+43; pos[5][1]=py+31; pos[6][0]=px+31; pos[6][1]=py+31; pos[7][0]=px+31; pos[7][1]=py+6; if(c1==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(c1==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(8, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- void rookdraw(int rx,int ry,int c1) //Drawing A Rook { int pos[20][2]; pos[0][0]=rx+6; pos[0][1]=ry+6; pos[1][0]=rx+6; pos[1][1]=ry+18; pos[2][0]=rx+18; pos[2][1]=ry+18; pos[3][0]=rx+18; pos[3][1]=ry+31; pos[4][0]=rx+6; pos[4][1]=ry+31; pos[5][0]=rx+6; pos[5][1]=ry+43; pos[6][0]=rx+43; pos[6][1]=ry+43; pos[7][0]=rx+43; pos[7][1]=ry+31; pos[8][0]=rx+31; pos[8][1]=ry+31; pos[9][0]=rx+31; pos[9][1]=ry+18; pos[10][0]=rx+43; pos[10][1]=ry+18; pos[11][0]=rx+43; pos[11][1]=ry+6; pos[12][0]=rx+37; pos[12][1]=ry+6; pos[13][0]=rx+37; pos[13][1]=ry+12; pos[14][0]=rx+31; pos[14][1]=ry+12; pos[15][0]=rx+31; pos[15][1]=ry+6; pos[16][0]=rx+18; pos[16][1]=ry+6; pos[17][0]=rx+18; pos[17][1]=ry+12; pos[18][0]=rx+12; pos[18][1]=ry+12; pos[19][0]=rx+12; pos[19][1]=ry+6; if(c1==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(c1==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(20, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ void drawknite(int kx,int ky,int c1) //Drawing A Knight { int pos[14][2]; pos[0][0]=kx+9; pos[0][1]=ky+21; pos[1][0]=kx+15; pos[1][1]=ky+15; pos[2][0]=kx+13; pos[2][1]=ky+13; pos[3][0]=kx+21; pos[3][1]=ky+6; pos[4][0]=kx+30; pos[4][1]=ky+15; pos[5][0]=kx+25; pos[5][1]=ky+37; pos[6][0]=kx+31; pos[6][1]=ky+37; pos[7][0]=kx+31; pos[7][1]=ky+43; pos[8][0]=kx+6; pos[8][1]=ky+43; pos[9][0]=kx+6; pos[9][1]=ky+37; pos[10][0]=kx+12; pos[10][1]=ky+37; pos[11][0]=kx+21; pos[11][1]=ky+24; pos[12][0]=kx+18; pos[12][1]=ky+18; pos[13][0]=kx+11; pos[13][1]=ky+26; if(c1==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(c1==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(14, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ void drawbishop(int bx,int by,int c1) //Drawing A Bishop { int pos[11][2]; pos[0][0]=bx+6; pos[0][1]=by+31; pos[1][0]=bx+21; pos[1][1]=by+31; pos[2][0]=bx+21; pos[2][1]=by+12; pos[3][0]=bx+18; pos[3][1]=by+9; pos[4][0]=bx+25; pos[4][1]=by+2; pos[5][0]=bx+31; pos[5][1]=by+9; pos[6][0]=bx+28; pos[6][1]=by+12; pos[7][0]=bx+28; pos[7][1]=by+31; pos[8][0]=bx+43; pos[8][1]=by+31; pos[9][0]=bx+43; pos[9][1]=by+43; pos[10][0]=bx+6; pos[10][1]=by+43; if(c1==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(c1==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(11, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ void drawqueen(int qx,int qy,int c1) //Drawing The Most Strong { //Piece A Queen int pos[10][2]; pos[0][0]=qx+6; pos[0][1]=qy+37; pos[1][0]=qx+15; pos[1][1]=qy+37; pos[2][0]=qx+21; pos[2][1]=qy+15; pos[3][0]=qx+18; pos[3][1]=qy+9; pos[4][0]=qx+31; pos[4][1]=qy+9; pos[5][0]=qx+28; pos[5][1]=qy+15; pos[6][0]=qx+34; pos[6][1]=qy+37; pos[7][0]=qx+43; pos[7][1]=qy+37; pos[8][0]=qx+43; pos[8][1]=qy+43; pos[9][0]=qx+6; pos[9][1]=qy+43; if(c1==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(c1==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(10, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ void drawking(int kx,int ky,int kc) //Drawing A King. { int pos[10][2]; pos[0][0]=kx+6; pos[0][1]=ky+37; pos[1][0]=kx+18; pos[1][1]=ky+37; pos[2][0]=kx+6; pos[2][1]=ky+18; pos[3][0]=kx+25; pos[3][1]=ky+6; pos[4][0]=kx+43; pos[4][1]=ky+18; pos[5][0]=kx+31; pos[5][1]=ky+37; pos[6][0]=kx+43; pos[6][1]=ky+37; pos[7][0]=kx+43; pos[7][1]=ky+43; pos[8][0]=kx+6; pos[8][1]=ky+43; if(kc==0) { setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); } else if(kc==1) { setcolor(BLACK); setfillstyle(SOLID_FILL, BLACK); } /* draw a filled polygon */ fillpoly(9, (int *)pos); } //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ int relposx(int x2) { //gives the click x pos in terms of standard coord. int x3,var; for(var=0;var<=350;var=var+50) { if(x2>=var && x2=var && y2 7 && dest < 56) //simply means at the row no 1 or row no 6 Pushmove(from, dest, MOVE_TYPE_NORMAL, Buffer, moveno); else { Pushmove(from, dest, MOVE_TYPE_PROMOTION_TO_QUEEN, Buffer, moveno); Pushmove(from, dest, MOVE_TYPE_PROMOTION_TO_ROOK, Buffer, moveno); Pushmove(from, dest, MOVE_TYPE_PROMOTION_TO_BISHOP, Buffer, moveno); Pushmove(from, dest, MOVE_TYPE_PROMOTION_TO_KNIGHT, Buffer, moveno); } } /*############################################################################# ##### Gen all moves of current_side , push them in Buffer ################# and return total number of moves############ #################################################################################*/ int Generate(int current_side, MOVE * Buffer) { int i, k, y, row, col, movecount; movecount = 0;//initialised to zero means initially no move in total. for (i = 0; i < 64; i++) /* Scan all board */ if (color[i] == current_side) { //means current person's turn switch (piece[i]) { //check its type. case PAWN: col = column(i); //find out its current position. row = row(i); if (current_side == BLACK) { //its black turn? if (color[i + 8] == EMPTY)//see whether we can promote?and allow single step. PushPawn(i, i + 8, Buffer, &movecount);//generate all moves. if (row == 1 && color[i + 8] == EMPTY && color[i + 16] ==EMPTY)//check whether we can allow two step. PushNormalmov(i, i + 16, Buffer, &movecount); if (col && color[i + 7] == WHITE) //colunn> 0 and nothing at diagonal. PushNormalmov(i, i + 7, Buffer, &movecount); if (col < 7 && color[i + 9] == WHITE)//nothing at other diagonal. PushNormalmov(i, i + 9, Buffer, &movecount); } else { if (color[i - 8] == EMPTY)//see for single step.For white. PushPawn(i, i - 8, Buffer, &movecount); if (row == 6 && color[i - 8] == EMPTY && color[i - 16] == EMPTY) PushNormalmov(i, i - 16, Buffer, &movecount);//see for double step. if (col && color[i - 9] == BLACK) PushNormalmov(i, i - 9, Buffer, &movecount);//check diag. if (col < 7 && color[i - 7] == BLACK) PushNormalmov(i, i - 7, Buffer, &movecount); } break; case QUEEN: /* == BISHOP+ROOK */ case BISHOP: for (y = i - 9; y >= 0 && column(y) != 7; y -= 9) { /* go left up*/ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } for (y = i - 7; y >= 0 && column(y) != 0; y -= 7) { /* go right up */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } for (y = i + 9; y < 64 && column(y) != 0; y += 9) { /* go right down */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } for (y = i + 7; y < 64 && column(y) != 7; y += 7) { /* go right down */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } if (piece[i] == BISHOP) break; /* FALL THROUGH FOR QUEEN {I dont mean to do that} ;-) */ case ROOK: col = column(i); for (k = i - col, y = i - 1; y >= k; y--) { /* go left */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY)//something in between. break; } for (k = i - col + 7, y = i + 1; y <= k; y++) { /* go right */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } for (y = i - 8; y >= 0; y -= 8) { /* go up */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } for (y = i + 8; y < 64; y += 8) { /* go down */ if (color[y] != current_side) PushNormalmov(i, y, Buffer, &movecount); if (color[y] != EMPTY) break; } break; //this is for great queen. case KNIGHT: col = column(i); y = i - 6;//check all eight moves. if (y >= 0 && col < 6 && color[y] != current_side)//1 PushNormalmov(i, y, Buffer, &movecount); y = i - 10; if (y >= 0 && col > 1 && color[y] != current_side)//2 PushNormalmov(i, y, Buffer, &movecount); y = i - 15; if (y >= 0 && col < 7 && color[y] != current_side)//3 PushNormalmov(i, y, Buffer, &movecount); y = i - 17; if (y >= 0 && col > 0 && color[y] != current_side)//4 PushNormalmov(i, y, Buffer, &movecount); y = i + 6; if (y < 64 && col > 1 && color[y] != current_side)//5 PushNormalmov(i, y, Buffer, &movecount); y = i + 10; if (y < 64 && col < 6 && color[y] != current_side)//6 PushNormalmov(i, y, Buffer, &movecount); y = i + 15; if (y < 64 && col > 0 && color[y] != current_side)//7 PushNormalmov(i, y, Buffer, &movecount); y = i + 17; if (y < 64 && col < 7 && color[y] != current_side)//8 PushNormalmov(i, y, Buffer, &movecount); break; case KING: col = column(i); if (col && color[i - 1] != current_side) PushNormalmov(i, i - 1, Buffer, &movecount); /* left */ if (col < 7 && color[i + 1] != current_side) PushNormalmov(i, i + 1, Buffer, &movecount); /* right */ if (i > 7 && color[i - 8] != current_side) PushNormalmov(i, i - 8, Buffer, &movecount); /* up */ if (i < 56 && color[i + 8] != current_side) PushNormalmov(i, i + 8, Buffer, &movecount); /* down */ if (col && i > 7 && color[i - 9] != current_side) PushNormalmov(i, i - 9, Buffer, &movecount); /* left up */ if (col < 7 && i > 7 && color[i - 7] != current_side) PushNormalmov(i, i - 7, Buffer, &movecount); /* right up */ if (col && i < 56 && color[i + 7] != current_side) PushNormalmov(i, i + 7, Buffer, &movecount); /* left down */ if (col < 7 && i < 56 && color[i + 9] != current_side) PushNormalmov(i, i + 9, Buffer, &movecount); /* right down */ break; default: outtextxy(50,430,"wrong piece selection"); } } return movecount; } /* **************************************************************************** * Evaluation for current position - main "brain" function * * just a rough idea, almost no knowlegde * *****************************************************************************/ int Evaluate() { int value_piece[6] = {VALUE_PAWN, VALUE_KNIGHT,VALUE_BISHOP, VALUE_ROOK, VALUE_QUEEN, VALUE_KING}; int i, score = 0; for (i = 0; i < 64; i++) { if (color[i] == WHITE) score += value_piece[piece[i]]; else if (color[i] == BLACK) score -= value_piece[piece[i]]; } if (player == WHITE) return score; return -score; } /* **************************************************************************** * Make and Take back a move if king is in Check * this will check and return 1 if side is in Check *****************************************************************************/ int IsInCheck(int current_side) { int k, h, y, row, col, xside; xside = (WHITE + BLACK) - current_side; /* opposite current_side,who may be checking */ /* Find King */ for (k = 0; k < 64; k++) if (piece[k] == KING && color[k] == current_side) break; row = row(k), col = column(k); /* Check attacking of Knight and also check all eight positions*/ if (col > 0 && row > 1 && color[k - 17] == xside && piece[k - 17] == KNIGHT)//1 return 1; if (col < 7 && row > 1 && color[k - 15] == xside && piece[k - 15] == KNIGHT)//2 return 1; if (col > 1 && row > 0 && color[k - 10] == xside && piece[k - 10] == KNIGHT)//3 return 1; if (col < 6 && row > 0 && color[k - 6] == xside && piece[k - 6] == KNIGHT)//4 return 1; if (col > 1 && row < 7 && color[k + 6] == xside && piece[k + 6] == KNIGHT)//5 return 1; if (col < 6 && row < 7 && color[k + 10] == xside && piece[k + 10] == KNIGHT)//6 return 1; if (col > 0 && row < 6 && color[k + 15] == xside && piece[k + 15] == KNIGHT)//7 return 1; if (col < 7 && row < 6 && color[k + 17] == xside && piece[k + 17] == KNIGHT)//8 return 1; /* Check horizontal and vertical lines for attacking of Queen, Rook,King */ /* go down */ y = k + 8;//at the square just down if (y < 64) { if (color[y] == xside && (piece[y] == KING || piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] == EMPTY)//means no body just down to serve you matar paneer. for (y += 8; y < 64; y += 8) { //move downward. if (color[y] == xside && (piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] != EMPTY) break; } } /* go left */ y = k - 1; h = k - col; if (y >= h) { if (color[y] == xside && (piece[y] == KING || piece[y] == QUEEN ||piece[y] == ROOK)) return 1; if (piece[y] == EMPTY)//means no body just left. for (y--; y >= h; y--) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] != EMPTY) break; } } /* go right */ y = k + 1; h = k - col + 7; if (y <= h) { if (color[y] == xside && (piece[y] == KING || piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] == EMPTY) for (y++; y <= h; y++) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] != EMPTY) break; } } /* go up */ y = k - 8; if (y >= 0) { if (color[y] == xside && (piece[y] == KING || piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] == EMPTY) for (y -= 8; y >= 0; y -= 8) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == ROOK)) return 1; if (piece[y] != EMPTY) break; } }//means only bishop and queen can serve you well...what? u know well. /* Check diagonal lines for attacking of Queen, Bishop, King, Pawn */ /* go right down - _ */ y = k + 9; if (y < 64 && column(y) != 0) { if (color[y] == xside) { if (piece[y] == KING || piece[y] == QUEEN || piece[y] == BISHOP) return 1; //check just right down if (current_side == BLACK && piece[y] == PAWN) return 1; } if (piece[y] == EMPTY) for (y += 9; y < 64 && column(y) != 0; y += 9) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == BISHOP)) return 1; if (piece[y] != EMPTY) break; } } /* go left down */ y = k + 7; if (y < 64 && column(y) != 7) { if (color[y] == xside) { if (piece[y] == KING || piece[y] == QUEEN || piece[y] == BISHOP) return 1; if (current_side == BLACK && piece[y] == PAWN) return 1; } if (piece[y] == EMPTY) for (y += 7; y < 64 && column(y) != 7; y += 7) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == BISHOP)) return 1; if (piece[y] != EMPTY) break; } } /* go left up */ y = k - 9; if (y >= 0 && column(y) != 7) { if (color[y] == xside) { if (piece[y] == KING || piece[y] == QUEEN || piece[y] == BISHOP) return 1; if (current_side == WHITE && piece[y] == PAWN) return 1; } if (piece[y] == EMPTY) for (y -= 9; y >= 0 && column(y) != 7; y -= 9) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == BISHOP)) return 1; if (piece[y] != EMPTY) break; } } /* go right up */ y = k - 7; if (y >= 0 && column(y) != 0) { if (color[y] == xside) { if (piece[y] == KING || piece[y] == QUEEN || piece[y] == BISHOP) return 1; if (current_side == WHITE && piece[y] == PAWN) return 1; } if (piece[y] == EMPTY) for (y -= 7; y >= 0 && column(y) != 0; y -= 7) { if (color[y] == xside && (piece[y] == QUEEN || piece[y] == BISHOP)) return 1; if (piece[y] != EMPTY) break; } } return 0; } //thank GOD u r safe. /*######################################################################## ##### ##### Makes The Move And Also Updates The Arrays ############ ##### and Also Take care Whether There Is a Promotion. ############ ########################################################################## #######*/ int MakeMove(MOVE m) { int r; hist[moveorder].m = m; hist[moveorder].cap = piece[m.dest];//entity lying at the destination of the move. piece[m.dest] = piece[m.from];//update values.if rook moves from 3 to 5 say thenwe will have rook at 5. piece[m.from] = EMPTY; //that is piece[5]=piece[3] initial pos become empty.final bcom // piece[m.from]=piece[m.dest]; color[m.dest] = color[m.from];//new initial.Also update color. color[m.from] = EMPTY; if (m.type >= MOVE_TYPE_PROMOTION_TO_QUEEN) {/*Means need of Promotion */ switch (m.type) { case MOVE_TYPE_PROMOTION_TO_QUEEN: piece[m.dest] = QUEEN;//place queen at that pos. break; case MOVE_TYPE_PROMOTION_TO_ROOK: piece[m.dest] = ROOK; break; case MOVE_TYPE_PROMOTION_TO_BISHOP: piece[m.dest] = BISHOP; break; case MOVE_TYPE_PROMOTION_TO_KNIGHT: piece[m.dest] = KNIGHT; break; default: puts("impossible to get here..."); // assert(false); } } ply++; moveorder++; r = !IsInCheck(player);//if in check r return zero. player= (WHITE + BLACK) - player; /* After making move, give turnto opponent */ return r; } /*######################################################################## ##### ##### Takes Back A Piece If It puts A King In Check or It Doesnt ############ ##### Deserve To Be Made. ############ ########################################################################## #######*/ void TakeBack() /* undo what MakeMove did */ { player = (WHITE + BLACK) - player; moveorder--; ply--; piece[hist[moveorder].m.from] = piece[hist[moveorder].m.dest]; piece[hist[moveorder].m.dest] = hist[moveorder].cap; color[hist[moveorder].m.from] = player; if (hist[moveorder].cap != EMPTY) color[hist[moveorder].m.dest] = (WHITE + BLACK) - player; else color[hist[moveorder].m.dest] = EMPTY; if (hist[moveorder].m.type >= MOVE_TYPE_PROMOTION_TO_QUEEN)/*Means ove was done by pawn for Promotion */ piece[hist[moveorder].m.from] = PAWN; } /* ************************************************************************** ** * Search function - a typical alphabeta, main search function * * No Way To Order The Moves * ************************************************************************** ** */ int Search(int alpha, int beta, int depth, MOVE * pBestMove) { int i, value, havemove, movecnt; MOVE moveBuf[200], tmpMove; nodes++; /* visiting a node, count it */ havemove = 0; pBestMove->type = MOVE_TYPE_NONE; movecnt = Generate(player, moveBuf); /* generate all moves for current position */ /* loop through the moves */ for (i = 0; i < movecnt; ++i) { if (!MakeMove(moveBuf[i])) { TakeBack(); continue; } havemove = 1; if (depth - 1 > 0) /* If depth is still, continue to search deeper */ value = -Search(-beta, -alpha, depth - 1, &tmpMove); else /* If no depth left (leaf node), go to evalute that position */ value = Evaluate(); TakeBack(); if (value > alpha) { /* This move is so good and caused a cutoff */ if (value >= beta) return beta; alpha = value; *pBestMove = moveBuf[i]; /* so far, current move is the best reaction for current position */ } } if (!havemove) { /* If no legal moves, that is checkmate or stalemate */ if (IsInCheck(player)) return -MATE + ply; /* add ply to find the longest path to lose or shortest path to win */ else return 0; } return alpha; } /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ @@@@ Computer also has the right to think.Isnt it? @@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @*/ MOVE ComputerThink(int max_depth) { MOVE m; int score; /* reset some values before searching */ ply = 0; nodes = 0; /* search now */ /*score =*/ Search(-MATE, MATE, max_depth, &m); /* after searching, print results */ return m; } /************************************************************************* *** ********************** Mouse Handling Routines ********************* ************************************************************************** **/ getmousepos(int *button,int* x,int* y) //gets mouse position. { i.x.ax=3; int86(0x33,&i,&o); *button=o.x.bx; *x=o.x.cx; *y=o.x.dx; return; } //======================================================================== showmouseptr() //shows pointer in graphics mode. { i.x.ax=1; int86(0x33,&i,&o); return; } //======================================================================== hidemouseptr() //hides pointer { i.x.ax=2; int86(0x33,&i,&o); return; } //======================================================================== restrictmouseptr(int x1,int y1,int x2,int y2) //restrict pointer { i.x.ax=7; i.x.cx=x1; i.x.dx=x2; int86(0x33,&i,&o); i.x.ax=8; i.x.cx=y1; i.x.dx=y2; int86(0x33,&i,&o); return; } //======================================================================== /**************************************************************************** * Main program * ****************************************************************************/ void main() { char choice,ch; int from, dest, i1=0; int button,x,y,x1,y1,x2,y2,x3,y3,j=0,k=0; int computer_side; int max_depth; /* max depth to search */ int bkground[6][2]={ {400,0},{639,0},{639,479},{0,479},{0,400},{400,400} }; MOVE moveBuf[200]; int movecnt; int gd=DETECT,gm; player = WHITE; computer_side = BLACK; /* Human is white side */ max_depth =6; moveorder = 0; restrictmouseptr(0,0,400,400); //restricts pointer of mouse in the area specified there. initgraph(&gd,&gm,""); setfillstyle(SOLID_FILL, 6); //prepares user interaction environment fillpoly(6,(int *)bkground); bottom(); sidelogo(); for (;;) { printboard(); showmouseptr(); if (player == computer_side) //if else { /* computer's turn */ /* Find out the best move */ MOVE bestMove = ComputerThink(max_depth); MakeMove(bestMove); continue; } else { k=k+1; outtextxy(100,415,"Your Turn.."); check=IsInCheck(player); //finds whether king in check. if( check ) { bottom(); outtextxy(100,415,"check your king"); } while(k) //while1 { if(kbhit()) { ch=getch(); if(ch==' ') //escape at pressing enter. exit(0); } getmousepos(&button,&x,&y); //gets click position of mouse if((button== 001)) { sound(1000); k=k-1; delay(50); nosound(); delay(500); } } //while 1 x1=relposx(x)/50; y1=relposy(y)/50; j=j+1; setcolor(5); rectangle(x1*50,y1*50,x1*50+50,y1*50+50); bottom();//clear bottom display while(j) //while 2 { if(kbhit()) { ch=getch(); if(ch==' ') //escape at pressing enter. exit(0); } getmousepos(&button,&x2,&y2); //gets click position of mouse if((button== 001)) { sound(500); j=j-1; delay(100); nosound(); delay(500); } } //while 2 x3=relposx(x2)/50; //gives standard x coordinate y3=relposy(y2)/50; //gives standard y coordinate setcolor(WHITE); //undo the changes rectangle(x1*50,y1*50,x1*50+50,y1*50+50); setfillpattern(pattern,5);//blink effect bar(x3*50,y3*50,x3*50+50,y3*50+50); delay(200); setcolor(WHITE); //undo the changes rectangle(x3*50,y3*50,x3*50+50,y3*50+50); from=8*y1+x1; //get from and destination acc to dest=8*y3+x3; //program's conventions. } //if else //############################################################################ //-------------------------------------CASTLING-------------------------------- //############################################################################ if( x1==4 && y1==7 && piece[60]==KING && x3==6 && y3==7 && piece[61]==EMPTY && piece[62]==EMPTY && piece[63]==ROOK && color[60]==WHITE && color[63]==WHITE && rookwm=='f' && kingwm=='f'&& check==0 && castlew=='f') { //we need not to check whether king will be in check at new position // bcoz if it will be in check the changes will be undone automatically //for the king not for the rook and turn will move only when move saves king. castling(WHITE); continue; } //______________________________User's Turn___________________________________ /* get user input */ /* maybe the user entered a move? */ movecnt = Generate(player, moveBuf); /* loop through the moves to see if it's legal */ for (i1 = 0; i1 < movecnt; i1++) //for if (moveBuf[i1].from == from && moveBuf[i1].dest == dest)//if 1 { if (piece[from] == PAWN && (dest < 8 || dest > 55)) //if 2 { /* Promotion move? */ outtextxy(50,415,"enter initial of the piece"); getch(choice); switch (choice) {//at promopte you must enter one more char. //switch case 'q': moveBuf[i1].type = MOVE_TYPE_PROMOTION_TO_QUEEN; break; case 'r': moveBuf[i1].type = MOVE_TYPE_PROMOTION_TO_ROOK; break; case 'b': moveBuf[i1].type = MOVE_TYPE_PROMOTION_TO_BISHOP; break; case 'n': moveBuf[i1].type = MOVE_TYPE_PROMOTION_TO_KNIGHT; break; default: outtextxy(50,430,"promoting to obvious choice queen"); moveBuf[i1].type = MOVE_TYPE_PROMOTION_TO_QUEEN; } //switch } //if 2 else if(piece[from] == ROOK && player==WHITE) rookwm='t'; //rook moved? else if(piece[from] == ROOK && player==WHITE) kingwm='t'; //king moved? if (!MakeMove(moveBuf[i1])) { //that move cant be made.King can be in check TakeBack();//this portion gives updated board. outtextxy(50,430,"Illegal move. "); } break; } //if 1 } //for loop } LADDER GAME __________ #include"dos.h" #include"graphics.h" #include #include #include #include #include #include union REGS i,o; main() { int initmouse(); int restrictmouseptr(int,int,int,int); int getmousepos(int *,int *,int *); int showmouseptr(); int gd=DETECT,gm,maxx,maxy,x,y,button; initgraph(&gd,&gm,""); int count=0; maxx=getmaxx(); maxy=getmaxy(); setbkcolor(1); setviewport(0,0,maxx,maxy,1); gotoxy(26,1); if(initmouse()==0) { closegraph(); restorecrtmode(); //to go back to normal graphics mode or deleting viewport. printf(" mouse driver not loaded"); exit(1); } restrictmouseptr(0,getmaxy()-20,maxx,getmaxy()-15); int a=30;int b=0; setcolor(0); setfillstyle(1,15); int score=0; count=20; int s=5; int level=0; char name[40]; gotoxy(5,2); cout<<"PLEASE ENTER YOUR SWEET NAME::-"; gets(name); gotoxy(5,2); cout<<" "; while(!kbhit()) { getmousepos(&button,&x,&y); setcolor(15); setfillstyle(1,15); fillellipse(a,b,10,15); if((b>getmaxy()-20)&&(b<=getmaxy()-15)) // For checking the egg position. { if(a>=(x-20)&&(a<=(x+60))) { score+=10; gotoxy(320,2); textcolor(13); cout<<"your score: "<getmaxy()+40) { b=0; a=random(getmaxx()); gotoxy(10,2); cout<<"eggs left: "< #include #include #include #include #include struct but3d { int x,y; }b[80]; struct opt { int x,y; int flag; int count; }op[20]; struct dump { int sc; char name[25]; }d[80]; int bricount=0,count=4,dx=10,x=400,y=400,bcnt=14,ii,length=60; int color,incy=0,fallflag=0,dely=5000,padhit=0; int ry=390,rx=425,dy=10,score=0,xb,yb,k=233,level=1,j,l=20,w=10,but,escflag=0; char s1[10],s[20],ch[1],mx,my,re,open; int a[80],t,c[80]; int hiscore,opc =4; char restart(); char openscreen(); main() { union REGS i,o; int gd=DETECT,gm; char *p1; /* start();*/ initgraph(&gd,&gm," "); setcolor(10); rectangle(10,10,630,410); open = openscreen(); switch(toupper(open)) { case 'D' : dely = 1000; break; case 'N' : dely = 2000; break; case 'E' : dely = 4000; break; } b[1].x=10+2*l; b[1].y=100; settextstyle(1,0,3); sprintf(s1,"Lifes = %d",count); setcolor(6); outtextxy(400,450,s1); sprintf(s,"Score = %d",score); setcolor(3); outtextxy(100,450,s); LEVEL : settextstyle(0,0,1); if(level==1) { bcnt=63; mess1(); } if(level==2) { bcnt =60; mess2(); } if(level==3) { bcnt=72; mess3(); } if(level ==4) { bcnt = 60; mess4(); } paddle(x,y,7,length); sprintf(ch,"%c",k); setcolor(12); outtextxy(rx,ry,ch); settextstyle(1,0,5); setcolor(2); rectangle(95,195,600,260); rectangle(97,197,598,258); S: setcolor(12); outtextxy(100,200,"Press ( SPACE ) to Play"); flushall(); if(getch()!=32) goto S; sprintf(ch,"%c",k); layer(20,190,610,300); setcolor(0); settextstyle(0,0,1); outtextxy(rx,ry,ch); setcolor(4); op[1].y = 150; op[1].x = b[25].x; for(t=1;t<=bcnt;t++ ) { a[t]=0; } while( 1) { setcolor(10); rectangle(10,10,630,410); if(ry>=y-6-4 ) { if(rxx+length-length/6) dx = 30; if(rx<=x+length/3&&rx>=x+length/6) dx=-10; if(rx>=x+length-length/3&&rx<=x+length-length/6) dx=10; if(rx>x+length/3&&rx<=x+length-length/3) dx = 5; music(50); dy = -dy; music(0); } if(ry<=10+6+4 ) {music(50); dy = 10; music(0); } if(rx>=630-6-10) {music(50); dx = -dx; music(0); } if(rx<=10+6+4 ) {music(50); dx = -dx; music(0); } ry= ry+dy; rx= rx+dx; sprintf(ch,"%c",k); setcolor(12); outtextxy(rx,ry,ch); delay(dely); setcolor(0); outtextxy(rx,ry,ch); xb=x;yb=y; if(kbhit()) { i.h.ah=0; int86(22,&i,&o); if(o.h.ah==1) escflag=1; if(o.h.ah==75) { music(41);paddle(x,y,0,length);x-=length/2;paddle(x,y,7,length); music(0); } if(o.h.ah==77) { music(41);paddle(x,y,0,length);x+=length/2;paddle(x,y,7,length); music(0); } if(o.h.ah==83) { settextstyle(0,0,2); setcolor(14); rectangle(20,195,600,298); rectangle(22,197,598,300); setcolor(1); outtextxy(120,210," ( PAUSE ) " ); outtextxy(50,250," Press Enter Key to Continue "); while(!kbhit()) ; layer(20,180,610,310); } } if(fallflag==1) { layer(op[1].x,op[1].y,op[1].x+15,op[1].y+11); op[1].y += 10; falloption(op[1].x,op[1].y,opc); if(op[1].y >= y-6-5) fallflag=0; } if(op[1].y >= y-6-4) check_catch_option(); check_died(); if(bricount==bcnt) { change_level(); goto LEVEL; } check_endgame(); check_hit_brick(); settextstyle(0,0,1); } /* end of while*/ } /* end of main*/ /* sub functions to check the progress of the game */ check_catch_option() { if(op[1].x>x&&op[1].xx+length) { layer(op[1].x,op[1].y,op[1].x+15,op[1].y+11); paddle(x,y,7,length); op[1].flag =0; op[1].x=100; op[1].y =150; } op[1].flag =0; } check_died() { if((rxx+length)&&ry >=y-6-4) { music(10); settextstyle(1,0,3); count=count-1; displaylifes(); rx=x+25;ry=y-10; if(x+l+5>= 630 ) rx = 50; music(0); } } check_endgame() { if(count==0||escflag==1||level>4) { settextstyle(1,0,5); layer(11,11,628,405); music(40); setcolor(2); rectangle(95,195,600,298); rectangle(97,197,598,296); setcolor(14); outtextxy(100,200," Game Over"); outtextxy(80,240," Another Game (y / n)"); music(0); re = restart(); if (re=='Y'||re=='y') { restore_defaults(); main(); } endscreen(); closegraph(); nosound(); exit(0); } } change_level() { level+=1; count+=1; bricount=0; length = 50; rx = x+5; ry = y-4-6; settextstyle(1,0,5); setcolor(2); rectangle(12,195,624,260); rectangle(13,196,623,259); setcolor(14); outtextxy(40,200," Level is completed"); outtextxy(40,300,"Press Space to Continue"); getch(); layer(11,194,629,400); } check_hit_brick() { for(j=1;j<=bcnt;j++) if(rx>=b[j].x-5&&rx<=b[j].x+l&&ry>=b[j].y-10&&ry<=b[j].y+w) { setfillstyle(1,0); bar(b[j].x,b[j].y,b[j].x+l+1,b[j].y+w+1); if(a[j]==0) { music(90); dy = -dy; score = score+10; displayscore(); bricount++; music(0); if(bricount<=15) opc =4; else if(bricount<=30) opc = 2; else if(bricount<=45) opc =1; else opc = 12; if(bricount%5==0&&op[1].flag==0) { op[1].flag=1; fallflag=1; op[1].y =150; op[1].x = 100+random(400); } } a[j]=1; } } /* function to create paddle */ paddle(int x,int y,int c,int len) { setcolor(c); rectangle(x,y,x+len,y+5); rectangle(x+1,y+1,x+len-1,y+4); rectangle(x+1,y+2,x+len-1,y+3); line(x,y-1,x+len,y-1); ellipse(x,y+2,0,360,4,3); ellipse(x+len,y+2,0,360,4,3); } /* functions to create bricks */ mess1() { for(j=1;j<=bcnt/3;j++) { b[j].y=b[1].y; button3d(b[j].x,b[j].y,l,w,6); letter(b[j].x,b[j].y,l,w,3,0); b[j+1].x=b[j].x+l+5; } b[j].x=b[1].x; for(j=bcnt/3+1;j<=2*bcnt/3;j++) { b[j].y=b[1].y+w+5; button3d(b[j].x,b[j].y,l,w,1); letter(b[j].x,b[j].y,l,w,4,14); b[j+1].x=b[j].x+l+5; } b[j].x=b[1].x; for(j=2*bcnt/3+1;j<=bcnt;j++) { b[j].y=b[1].y+2*w+10; button3d(b[j].x,b[j].y,l,w,6); letter(b[j].x,b[j].y,l,w,5,0); b[j+1].x=b[j].x+l+5; } } mess2() { for(j=1;j<=bcnt/4;j++) { b[j].y = 100; button3d(b[j].x,b[j].y,l,w,8,14); letter(b[j].x,b[j].y,l,w,6); b[j+1].x=b[j].x+l+2; } b[j].x =200; for(j=bcnt/4+1;j<=bcnt/2;j++) { b[j].y = 100+2*w; button3d(b[j].x,b[j].y,l,w,4,14); letter(b[j].x,b[j].y,l,w,6); b[j+1].x=b[j].x+l+2; } b[j].x = 200; for(j=bcnt/2+1;j<=3*bcnt/4;j++) { b[j].y = 100+4*w; button3d(b[j].x,b[j].y,l,w,1,14); letter(b[j].x,b[j].y,l,w,6); b[j+1].x=b[j].x+l+2; } b[j].x = b[1].x; for(j=3*bcnt/4+1;j<=bcnt;j++) { b[j].y = 100+6*w; button3d(b[j].x,b[j].y,l,w,6,14); letter(b[j].x,b[j].y,l,w,6); b[j+1].x=b[j].x+l+2; } } mess3() { for(j=1;j<=24;j+=1) { b[j].y = b[1].y; button3d(b[j].x,b[j].y,l,w,9); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+l+2; } b[j].x=b[1].x; for(j=25;j<=48;j+=1) { b[j].y = b[1].y+w+2; button3d(b[j].x,b[j].y,l,w,9); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+l+2; } b[j].x=b[1].x; for(j=49;j<=72;j+=1) { b[j].y = b[1].y+2*w+4; button3d(b[j].x,b[j].y,l,w,9); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+l+2; } } mess4() { b[j].x =b[1].x; for(j=1;j<=13;j+=1) { b[j].y = 100 - 1; button3d(b[j].x,b[j].y,l,w,9,14); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+2*l; } b[j].x=b[1].x+2*w; for(j=14;j<=25;j+=1) { b[j].y = 100+2*w; button3d(b[j].x,b[j].y,l,w,9,14); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+2*l; } b[j].x=b[1].x+4*w; for(j=26;j<=36;j+=1) { b[j].y = 100+4*w; button3d(b[j].x,b[j].y,l,w,9,14); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+2*l; } b[j].x=b[1].x+6*w; for(j=37;j<=46;j+=1) { b[j].y = 100 + 6*w; button3d(b[j].x,b[j].y,l,w,9,14); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+2*l; } b[j].x = b[1].x + 8*w; for(j=47;j<=55;j++) { b[j].y = 100 + 8*w ; button3d(b[j].x,b[j].y,l,w,9,14); letter(b[j].x,b[j].y,l,w,1); b[j+1].x=b[j].x+2*l; } } /* function to clear a layer */ layer(int x1,int y1,int x2,int y2) { setfillstyle(1,0); bar(x1,y1,x2,y2); } /* functon to produce various sounds */ music(int opt) { int a; if(opt==0) nosound(); /* for(a=1;a<=opt;a++) { sound(5+2*opt); delay(10); } */ } char openscreen() { char reply; layer(11,11,629,399); settextstyle(0,0,1); setcolor(12); outtextxy(300,0,"DJ-BALL"); settextstyle(4,0,3); setcolor(2); outtextxy(31,11*7," This Game was developed by jo."); outtextxy(31,14*7," Use Left and Right arrows to move your Paddle."); outtextxy(31,17*7," You will lose a life when the ball touch the "); outtextxy(31,20*7," ground. For each brick you will get 10 points."); outtextxy(31,23*7," if all the bricks are over in each level you"); outtextxy(31,26*7," will get a bonus life. "); line(10,26*10,630,26*10); setcolor(4); settextstyle(1,0,3); outtextxy(31,29*10," SELECT LEVEL "); outtextxy(31,33*10," (D)ifficult "); outtextxy(31,35*10," (N)ormal "); outtextxy(31,37*10," (E)asy "); reply = getch(); layer(11,11,629,399); return(reply); } /* function for option falling */ falloption(int x,int y,int c) { button3d(x,y,10,10,c); letter(x,y,10,10,'+',0); delay(1000); } endscreen() { } restore_defaults() { bricount=0;count=4;dx=10;x=400;y=400;bcnt=14;padhit=0; ry=390;rx=425;dy=10;score=0;k=233;level=1;l=20;w=10;escflag=0; length=50; } char restart() { return(getch()); } /* function to create a single brick */ button3d(int x,int y,int l,int w,int c) { setcolor(LIGHTGRAY); setfillstyle(1,c); bar(x,y,x+l,y+w); setcolor(WHITE); line(x,y,x+l,y); line(x,y,x,y+w); setcolor(DARKGRAY); line(x+l+1,y,x+l+1,y+w+1); line(x,y+w+1,x+l+1,y+w+1); } /* function to display symbol on brick */ letter(int x,int y,int l,int w,int ch,int c) { char s[1]; setcolor(c); sprintf(s,"%c",ch); outtextxy(x + l/4 + 2,y + w/5, s); } displaylifes() { settextstyle(1,0,3); setcolor(0); outtextxy(400,450,s1); sprintf(s1,"Lifes = %d",count); setcolor(6); outtextxy(400,450,s1); } displayscore() { settextstyle(1,0,3); setcolor(0); outtextxy(100,450,s); sprintf(s,"Score = %d",score); setcolor(3); outtextxy(100,450,s); } MIND READER GAME _______________ Play like this :- Take any two digit number, add the two digits of the number, subtract the sum from the original number, see the symbol corresponding to the number u got and press any key , the mind reader displays the symbol. #include #include #include #include void fun(int x,int y,int n,int a) { textcolor(13); gotoxy(x,y); cprintf("%d->%c",n,a); } void box(int c,int r,int s,int y) { int i ; textcolor(3); gotoxy(s,y); cprintf("%c",218); for(i=s+1;i%c ",i,a[rand()%65]); gotoxy(10,i+1); cprintf("%d->%c ",i+22,a[rand()%65]); gotoxy(17,i+1); cprintf("%d->%c ",i+44,a[rand()%65]); gotoxy(24,i+1); cprintf("%d->%c ",i+66,a[rand()%65]); } fun(3,10,9,r); fun(3,19,18,r); fun(10,6,27,r); fun(10,15,36,r); fun(17,2,45,r); fun(17,11,54,r); fun(17,20,63,r); fun(24,7,72,r); fun(24,16,81,r); for(i=1;i<12;i++) { gotoxy(31,i+1); cprintf("%d->%c ",i+88,a[rand()%65]); } gotoxy(55,7); textcolor(15+BLINK); cprintf("Press Any Key"); getch(); gotoxy(55,7); textcolor(BLACK); cprintf("Press Any Key"); gotoxy(61,7); textcolor(15+BLINK); cprintf("%c",r); } void main() { int i; clrscr(); ran(); getch(); } TALKING CLOCK ____________ import java.util.*; public class CLockTAlk { public static void main(String[]args) { // get current time and date Calendar now = Calendar.getInstance(); int hour = now.get(Calendar.HOUR_OF_DAY); int minute = now.get(Calendar.MINUTE); int month = now.get(Calendar.MONTH)+ 1; int day = now.get(Calendar.DAY_OF_MONTH); int year = now.get(Calendar.YEAR); // display gretting if (hour < 12) System.out.println("Good morning Sir! Have you ate breakfast yet?"); else if (hour < 18) System.out.println("Good afternoon Sir! Have you ate lunch yet?"); else System.out.println("Good evening Sir! Have you ate dinner yet?"); // begin time message by showing the minutes System.out.print("It is"); if (minute != 0) { System.out.print(" " + minute + " "); System.out.print( (minute != 1) ? "minutes" : "minute"); System.out.print(" past"); } // display the hour System.out.print(" "); System.out.print( (hour > 12) ? (hour - 12) : hour ); System.out.print(" 0'clock on "); // display the name of the month switch (month) { case 1: System.out.print("January"); break; case 2: System.out.print("February"); break; case 3: System.out.print("March"); break; case 4: System.out.print("April"); break; case 5: System.out.print("May"); break; case 6: System.out.print("June"); break; case 7: System.out.print("July"); break; case 8: System.out.print("August"); break; case 9: System.out.print("September"); break; case 10: System.out.print("October"); break; case 11: System.out.print("November"); break; case 12: System.out.print("December"); } // display the date and year System.out.println(" " + day + ", " + year + "."); } } DECODING A HTML FILE ____________________ <% Private Function HTMLDecode(ByVal encodedstring) Dim tmp, i tmp = encodedstring tmp = Replace( tmp, """, Chr(34) ) tmp = Replace( tmp, "<" , Chr(60) ) tmp = Replace( tmp, ">" , Chr(62) ) tmp = Replace( tmp, "&" , Chr(38) ) tmp = Replace( tmp, " ", Chr(32) ) For i = 1 To 255 tmp = Replace( tmp, "&#" & i & ";", Chr( i ) ) Next HTMLDecode = tmp End Function %> FLYING KYTE ______________ #include #include #include #include #include int main() { int gd=DETECT,gm; int y=480,x=0; int rad=0; int start=0,end=90; initgraph(&gd,&gm,"c:\tc\bgi"); if (graphresult()!=grOk) { fprintf(stderr,"main:unable to load graph"); exit(1); } while(!kbhit()) { cleardevice(); start-=4; end-=4; if(x<640) x+=4; else x=0; if(y>0) y-=4; else y=480; setcolor(3); setfillstyle(SOLID_FILL,RED); setlinestyle(DOTTED_LINE,1,1); line(x,y,x-40,y-40); line(x-40,y-40,x,y-80); line(x,y-80,x+40,y-40); line(x+40,y-40,x,y); line(x,y,x-7,y+10); line(x-7,y+10,x+8,y+10); line(x,y,x+7,y+10); line(x,y+10,x,y+50); line(x-40,y-40,x+40,y-40); line(x,y-80,x,y); line(x,y-40,640,480); delay(100); } //closegraph(); return 0; } BAR GRAPH ___________ #include #include #include #include #include int main(void) { int a[10]; int gd,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\tc\bgi"); cleardevice(); printf("enter the number of values "); int n; scanf("%d",&n); printf("enter values one by one "); for(int i=0;i #include #include #include #include int main(void) { int gd,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\tc\bgi"); printf("enter the number of rings "); int n; scanf("%d",&n); cleardevice(); int r=0; for(int i=0;i<=n;++i) { arc(getmaxx()/2,getmaxy()/2,0,180,r); arc(getmaxx()/2+6,getmaxy()/2,180,360,r+6); r+=12; } getch(); closegraph(); return 0; } FISH MOVEMENT ______________ #include #include #include #include #include int main() { int gd=DETECT,gm; int x=0; int rad=0; int start=0,end=90; initgraph(&gd,&gm,"c:\tc\bgi"); if (graphresult()!=grOk) { fprintf(stderr,"main:unable to load graph"); exit(1); } while(!kbhit()) { cleardevice(); start-=4; end-=4; if(x<640-rad) x+=10; else x=0; //if(y<480) //y+=4; //else //y=0; setfillstyle(EMPTY_FILL,BLACK); arc(x,180,30,150,50); arc(x,130,210,330,50); line(x-42,155,x-80,130); line(x-42,155,x-80,180); line(x-80,180,x-80,130); circle(x+20,150,5); circle(x+60,155,7); circle(x+63,130,5); circle(x+66,110,3); arc(x,300,30,150,50); arc(x,253,210,330,50); delay(100); }closegraph(); return 0;} WHEEL ROTATION _______________ #include #include #include #include #include int main() { int gd=DETECT,gm; int x=0; int start=0,end=90; int rad=50; initgraph(&gd,&gm,"c:\tc\bgi"); if (graphresult()!=grOk) { fprintf(stderr,"main:unable to load graph "); exit(1); } while(!kbhit()) { cleardevice(); setbkcolor(8); start-=4; end+=4; if (x<640+rad) x+=1; else x=0; setfillstyle(SOLID_FILL,BLACK); pieslice(x,240,start,end,rad); pieslice(x,240,start -180,end -180,rad); circle(x,240,rad); delay(500); } closegraph(); return 0; } MOVING CAR _____________ #include #include #include #include #include int main() { int gd=DETECT,gm; int x=0; int start=0,end=90; int rad=30; initgraph(&gd,&gm,"c:\tc\bgi"); if(graphresult()!=grOk) { fprintf(stderr,"main:unable to load"); exit(1); } while(!kbhit()) { cleardevice(); start-=4; end-=4; if(x<640-rad) x+=1 ; else x=0; setfillstyle(SOLID_FILL,BLUE); pieslice(x,240,start,end,rad); pieslice(x,240,start-180,end-180,rad); circle(x,240,rad); setfillstyle(SOLID_FILL,BLUE); pieslice(x+120,240,start,end,rad); pieslice(x+120,240,start-180,end-180,rad); circle(x+120,240,rad); line(x+rad,240,x-rad+120,240); line(x-rad,240,x-rad-45,240); line(x+rad+120,240,x+rad+210,240); line(x-rad-45,240,x-60,180); line(x-60,180,x-10,180); line(x-10,180,x+rad,150); line(x+rad,150,x+130,150); line(x+130,150,x+150+10,180); line(x+160,180,x+210,180); line(x+210,180,x+240,240); delay(150);} closegraph();return 0;} MIDPOINT CIRCLE ALGORITHM _________________________ #include #include #include #include #include void swap(int &x,int &y) { int t= x; x = y; y = t; } void plotpixel(int x,int y,int t,int flag) { if(flag) { swap(x,y); x-=t/2; for(int i=0;idx) { swap(x1,y1); swap(x2,y2); swap(dx,dy); flag=1; } if(x1>x2) { swap(x1,x2); swap(y1,y2); } if(y1>y2) incy = -1; int d = 2*dy-dx; while(x1"); scanf("%d",&t); printf("Enter the no of points==>"); scanf("%d",&n); printf("Enter the points==>"); for(int i=0;i #include #include #include #include #define O_X 50 #define O_Y 50 void swap(int &x,int &y) { int t=x; x=y; y=t; } void bres(int x1,int y1,int x2,int y2) { int dx=abs(x1-x2),dy=abs(y1-y2),flag=0,incy=1; if(dy>dx) { swap(x1,y1); swap(x2,y2); swap(dx,dy); flag=1; } if(x1>x2) { swap(x1,x2); swap(y1,y2); } if(y1>y2) incy =-1; int d = 2*dy - dx; while(x1"); scanf("%d",&n); for(int i=0;i",i+1); scanf("%d%d",&x[i],&y[i]); } initgraph(&gd,&gm,"c:\cpp\bgi"); line(50,25,50,480-50); line(50,480-50,640-25,480-50); outtextxy(0,240,"Y-Axis"); outtextxy(310,455,"X-Axis"); for(i=0;is3.length()-1) { char e=s3.charAt(p); if(l==d) { s3.deleteCharAt(p); //String s4=new String(); s4=s3.substring(p,s3.length()); ////System.out.println(s4); s3.delete(p,s3.length()); ////System.out.println(s3); s3.insert(0,s4); ////System.out.println(s3); break; } else{ p++; if(p==s3.length()) {p=0; } } } else { char e=s3.charAt(n); if(l==d) { s3.deleteCharAt(n); s4=s3.substring(n,s3.length()); ////System.out.println(s4); s3.delete(n,s3.length()); ////System.out.println(s3); s3.insert(0,s4); ////System.out.println(s3); break; } //break; } } } ////System.out.println(s3); char result=s3.charAt(0); switch(result){ case 'f': System.out.println(second+" is ur Friend"); break; case 'l': System.out.println(second+" is ur Love"); break; case 'a': System.out.println(second+" is ur Affection"); break; case 'm': System.out.println("u r going to marry "+ second); break; case 'e': System.out.println(second + " is ur Enemy"); break; case 's': System.out.println(second +" is ur Sister"); break; } } } Fibonacci Series /* to Copy Text from Different Field. */ Copy text

Copy text from different field

to Create and Validate Form in JavaScript

User Name:

Password:

Confirm Password:

Address:

to Generate Confirm Box in JavaScript
to find Palindrome using JavaScript
Enter a String/Number:
to find Odd or Even Numbers using JavaScript Simple Switch Case JavaScript Stay tuned to Get More like this!!!!