Add to Favorites    Make Home Page 15099 Online
 Language Categories
 Source Codes Home Project Ideas New! Interview Questions FAQs Home ASP Home ASP Source Codes ASP Script Directory New! ASP .Net Script Directory New! ASP Interview Questions ASP FAQs ASP How Tos C Home C Source Codes C Script Directory New! C Interview Questions C FAQs C How Tos C++ Home C++ Source Codes C++ Script Directory New! C++ Interview Questions C++ FAQs C++ How Tos Java Home Java Source Codes Java Directory New! Java Interview Questions Java FAQs Java How Tos JavaScript Home JavaScript Directory New! JavaScript Source Codes JavaScript FAQs JavaScript How Tos COBOL Home COBOL Source Codes COBOL FAQs COBOL How Tos Pascal Home Pascal Source Codes Pascal FAQs Pascal How Tos PHP Script Directory New! Python Script Directory New! Perl & CGI Script Directory New! Flash Script Directory New! CFML Script Directory New! Remotely Hosted Scripts New! Tools & Utilities Directory New! XML Script Directory New! Best Programmers Amit Mathur Vishal Bhardwaj Deepesh Jain Vyom NetWork
 Our Services

Home » C Home » Beginners / Lab Assignments Home » Puzzle--finding the number

A D V E R T I S E M E N T

Search Projects & Source Codes:

 Title Puzzle--finding the number Author Vinoth Author Email vintaf_2 [at] yahoo.com Description This is a puzzle game Category C » Beginners / Lab Assignments Hits 365377 Code Select and Copy the Code #include #include #include #include #include int mx,my,ans=0,p=4; screen(); void button(); /* The main logic lies in displaying the numbers in the screen The numbers are placed corresponding to their binary value EX:In case of 14(binary equivalent is 01110).Therefore it will be placed in 2,3 & 4 screen */ int s1[]={16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; int s2[]={8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31}; int s3[]={4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31}; int s4[]={2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31}; int s5[]={1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31}; int a1,a2,a3,a4,a5; void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"c:\tc\bgi"); mouseini(); showmp(); action(); } action() { int ans=0; char st[10]; initialscreen(); while(1) { /* The X & Y coordinate of each function is calculated with respect to mx "maximum of x value" & my "maximum of y value" */ if(click((mx/4)+95,(my/4)+100,(mx/4)+235,(my/4)+140,"Play..")==0) { a1=screen(s1,16); a2=screen(s2,16); a3=screen(s3,16); a4=screen(s4,16); a5=screen(s5,16); ans=a1+a2+a3+a4+a5; result(ans); getch(); exit(); } } } initialscreen() { mx=getmaxx(),my=getmaxy(); setmp(); setfillstyle(1,7); bar(mx/4,my/4,3*mx/4,3*my/4); setcolor(WHITE); line(mx/4,my/4,3*mx/4,my/4); line(mx/4,my/4,mx/4,3*my/4); setcolor(BLACK); line(mx/4,3*my/4,3*mx/4,3*my/4); line(3*mx/4,my/4,3*mx/4,3*my/4); setcolor(RED); outtextxy((mx/4)+40,(my/4)+30,"THINK A NUMBER BETWEEN 1-31"); button((mx/4)+95,(my/4)+100,(mx/4)+235,(my/4)+140,"Play.."); } screen(int *scr,int num) { int a,i,x1,y1; char st[10]; mx=getmaxx(),my=getmaxy(); setmp(); setfillstyle(1,7); bar(mx/4,my/4,3*mx/4,3*my/4); setcolor(WHITE); line(mx/4,my/4,3*mx/4,my/4); line(mx/4,my/4,mx/4,3*my/4); setcolor(BLACK); line(mx/4,3*my/4,3*mx/4,3*my/4); line(3*mx/4,my/4,3*mx/4,3*my/4); setcolor(RED); outtextxy((mx/4)+9,(my/4)+5,"TELL ME WHETHER THE NUMBER IS PRESENT?"); button((3*mx/4)-40 ,(3*my/4)-20,(3*mx/4)-5 ,(3*my/4)-5,"yes"); button((3*mx/4)-80 ,(3*my/4)-20,(3*mx/4)-45 ,(3*my/4)-5,"no"); x1=(mx/4)+80; y1=(my/4)+65; for(i=0;ix1 && xy1 && y

Related Source Codes

 Script Name Author The Game Opposite as seen on Nokia 2300 Mobile Manikanta RECURSIVE BALANCED QUICK SORT ashish Radix Sort ashish Change your mouse pointer Ashim The blinking star Shashank Data Validation Crylittlebaby To search a file by giving file type like mp3 or mpeg or doc Prashanth SR Menus Demonstration B.Chidhambaram Employee Database Project Using C. Reenku Raman Nayak Creating a Lexical Analyzer in c fahad bader al-buhairi ¦Õ¤ ?¤Ð Ãß??ÝÐÝ Calendar Program Omkar & Devendra Stop double Process for start in C Cedrik Jurak Stop double Process for start in C Cedrik Jurak Time Scheduler Atiq Anwar A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T

Subscribe to SourceCodesWorld - Techies Talk
Email:

 Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home