Add to Favorites    Make Home Page 3780 Online  
 Language Categories  
 Our Services  

Home » C++ Home » Beginners / Lab Assignments Home » Month Viewer

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

Search Projects & Source Codes:

Title Month Viewer
Author Suveesh Vijayan
Author Email suveeshvijayan [at] gmail.com
Description
Category C++ » Beginners / Lab Assignments
Hits 369312
Code Select and Copy the Code
Code : //Created by Suveesh Vijayan //Msc Computer Science Student //Department of Computer Science,University of Kerala,Trivandrum,Kerala //For Help please e-mail- suveeshvijayan@gmail.com #include<graphics.h> #include<string.h> #include<iostream.h> #include<stdlib.h> #include<conio.h> #include<ctype.h> #include<time.h> #include<math.h> #include<dos.h> union REGS in,out; /******************************Mouse************************************** */ class mouse { public: int x,y,button; void getmousestatus() { in.x.ax=3; int86(0x33,&in,&out); button=out.x.bx; x=out.x.cx; y=out.x.dx; } void initmouse() { in.x.ax=0; int86(0x33,&in,&out); } void showmouse() { in.x.ax=1; int86(0x33,&in,&out); } void hidemouse() { in.x.ax=2; int86(0x33,&in,&out); } }; /*******************class first page**************************************/ class firstpage :virtual public mouse { public: firstpage() { } void show(); void scroll(); void credits(); }; void firstpage :: show() { setcolor(15); setfillstyle(1,9); bar3d(0,0,getmaxx(),424,0,0); setcolor(15); settextstyle(5,0,7); outtextxy(80,179,"MONTH VIEWER"); for(int i=180;i<190;i++) { setcolor(0); settextstyle(5,0,7); outtextxy(80,i,"MONTH VIEWER"); } setcolor(1); outtextxy(80,190,"MONTH VIEWER"); setcolor(15); setfillstyle(1,1); settextstyle(2,0,5); bar3d(0,455,getmaxx(),getmaxy(),0,0); outtextxy(200,459,"Press any key to continue...."); } /******************* scrolling text in page 1 *****************************/ void firstpage :: scroll() { settextstyle(2,0,6); setviewport(0,425,639,454,0); for(int i=624;i>=-100;i=i-3) { outtextxy(i,1,"Designed and developed by SUVEESH VIJAYAN "); delay(30); clearviewport(); if(kbhit()) // if kbhit return to main() return; if(i==-100) i=624; } } /****************************** credits *********************************/ void firstpage :: credits() { setcolor(15); setfillstyle(1,7); bar3d(550,410,630,425,0,0); setcolor(0); settextstyle(2,0,4); outtextxy(570,412,"CREDITS"); getmousestatus(); while((button==1) && (x>=550 && x<=630 && y>=410 && y<=425)) { getmousestatus(); if(button==1) { hidemouse(); setcolor(0); line(550,410,630,410); line(550,410,550,425); setfillstyle(1,7); bar3d(549,340,630,411,0,0); showmouse(); } } hidemouse(); setcolor(15); line(550,410,630,410); line(550,410,550,425); setcolor(1); setfillstyle(SOLID_FILL,1); bar3d(549,340,630,410,0,0); showmouse(); } /***************************class second page****************************/ class secpage:virtual public mouse { public: int poly[8],flag; char *text,*string; int val,yearp,cdate; secpage() { flag=0; setbkcolor(0); val=1; // default value of january when program starts yearp=1; string="January"; } void def_secpage(); void currdate(); void selmonth(); //select the month to display from popdown menu void highlight(int,int,int,int,char *); void cursor(int); //showing cursor in the year input bar3d void user_delay(float);// delay to calculate the seconds in time void time(); // display current time void getyear(); //Input the year to display void place_in_bar3d(char*); // place the month in the bar3d after selecting from the popdown menu void c1(); // mouse LEFT_CLICK for displaying month names void c2(); // mouse OVER to highlight month names void showbutton(); void click(int,int,int,int); void noclick(int,int,int,int); }; /************** select the month to display from popdown menu ***************/ /***/ void secpage::def_secpage() { hidemouse(); //hidemouse before fn setbkcolor(0); //set background color setcolor(WHITE); //set color for lines n text // window borders(two) rectangle(1,11,getmaxx(),getmaxy());//outer white border setfillstyle(1,8); bar(0,0,639,17); //title bar blue noclick(0,0,639,17); //3d effect settextstyle(2,0,4); setcolor(15); outtextxy(3,4,"Calendar"); setfillstyle(1,8); bar(623,4,635,15); //bar for close x noclick(623,4,635,15); //3d effect setcolor(0); settextstyle(0,0,0); outtextxy(626,6,"x"); //x in upper right //Month setcolor(15); settextstyle(2,0,4); outtextxy(25,45,"MONTH"); setfillstyle(1,0); //list box for month bar3d(83,38,154,54,0,0); setfillstyle(1,8); bar(154,38,169,55); // down arrow box noclick(154,38,169,55); setcolor(0); poly[0]=157; poly[1]=43; poly[2]=161; poly[3]=46; poly[4]=165; poly[5]=43; poly[6]=161; poly[7]=52; // drawing arrow setfillstyle(1,15); fillpoly(4,poly); setcolor(15); // color of month names setfillstyle(0,1); settextstyle(2,0,4); outtextxy(93,39,"January"); settextstyle(2,0,4); outtextxy(200,45,"YEAR"); setfillstyle(1,0); // box for year bar3d(245,38,320,54,0,0); settextstyle(2,0,5); setcolor(LIGHTGREEN); outtextxy(262,38,"1"); setcolor(15); settextstyle(2,0,4); showmouse(); } /***/ void secpage::currdate() { char *str; setcolor(15); outtextxy(405,35,"CURRENT DATE : "); struct date d; //struct for date getdate(&d); gotoxy(12,12); cdate=d.da_day; itoa(d.da_day,str,10); outtextxy(515,35,str); outtextxy(535,35,"/"); itoa(d.da_mon,str,10); outtextxy(545,35,str); outtextxy(565,35,"/"); itoa(d.da_year,str,10); outtextxy(575,35,str); } void secpage :: user_delay(float secs) { clock_t start, end; start = clock(); do { getmousestatus(); end = clock(); if(kbhit()) break; if(button==1) break; if(button==2) break; }while(((end - start)/CLK_TCK)<secs); } /************************ display current time *****************************/ void secpage :: time() { struct time t; gettime(&t); char H[2],M[2],S[2]; if(t.ti_hour>12) t.ti_hour-=12; if(t.ti_min>60) t.ti_min-=60; settextstyle(2,0,4); setcolor(15); outtextxy(405,60,"CURRENT TIME : "); setfillstyle(1,0); bar(515,58,600,73); setcolor(15); itoa(t.ti_hour,H,10); outtextxy(520,60,H); outtextxy(540,60,":"); itoa(t.ti_min,M,10); outtextxy(550,60,M); outtextxy(570,60,":"); itoa(t.ti_sec,S,10); outtextxy(580,60,S); user_delay(1); // user written delay } void secpage :: showbutton() { hidemouse(); setfillstyle(1,8); bar(350,38,390,54); //ok noclick(350,38,390,54); //ok bar(540,300,610,320);//exit noclick(540,300,610,320);//exit bar(540,270 ,610,290);//refresh noclick(540,270 ,610,290);//refresh setcolor(15); outtextxy(360,42,"OK"); outtextxy(550,305,"Exit"); outtextxy(550,275,"Refresh"); showmouse(); } void secpage :: selmonth() { getmousestatus(); if((button==1)&&(x>=154 && x<=167 && y>=38 && y<=54)) // left click { click(154,38,167,54); setfillstyle(1,0); flag=1; c1(); } getmousestatus(); if((button==0)&&(flag==1)) { getmousestatus(); while(button==0) { c2(); } } // for clearing bar3d containing month names getmousestatus(); if((button==1) && (!(x>83 && x<=168 && y>=55 && y<=212))) { setcolor(1); setfillstyle(1,0); bar(83,55,168,212); flag=0; } } /************** LEFT button click for displaying month names *************/ void secpage :: c1() { hidemouse(); setcolor(WHITE); bar3d(83,55,168,212,0,0); int x=93;// x ix the text position inside bar3d settextstyle(2,0,4); outtextxy(x,55,"January"); outtextxy(x,68,"February"); outtextxy(x,81,"March"); outtextxy(x,94,"April"); outtextxy(x,107,"May"); outtextxy(x,120,"June"); outtextxy(x,133,"July"); outtextxy(x,146,"August"); outtextxy(x,159,"September"); outtextxy(x,172,"October"); outtextxy(x,185,"November"); outtextxy(x,198,"December"); showmouse(); } void secpage::c2() { getmousestatus(); if((button==0) && (x>83 && x<=168 && y>=55 && y<=212) && (flag==1)) { if(y>54 && y<68) highlight(83,55,168,68,string="January"); if(y>67 && y<81) highlight(83,68,168,81,string="February"); if(y>80 && y<94) highlight(83,81,168,94,string="March"); if(y>93 && y<107) highlight(83,94,168,107,string="April"); if(y>106 && y<120) highlight(83,107,168,120,string="May"); if(y>119 && y<133) highlight(83,120,168,133,string="June"); if(y>132 && y<146) highlight(83,133,168,146,string="July"); if(y>145 && y<159) highlight(83,146,168,159,string="August"); if(y>158 && y<172) highlight(83,159,168,172,string="September"); if(y>171 && y<185) highlight(83,172,168,185,string="October"); if(y>184 && y<198) highlight(83,185,168,198,string="November"); if(y>197 && y<211) highlight(83,198,168,211,string="December"); } if(button==1 && x>83 && x<168 && y>55 && y<212) { place_in_bar3d(string); if(strcmp("January",string)==0) val=1; if(strcmp("February",string)==0) val=2; if(strcmp("March",string)==0) val=3; if(strcmp("April",string)==0) val=4; if(strcmp("May",string)==0) val=5; if(strcmp("June",string)==0) val=6; if(strcmp("July",string)==0) val=7; if(strcmp("August",string)==0) val=8; if(strcmp("September",string)==0) val=9; if(strcmp("October",string)==0) val=10; if(strcmp("November",string)==0) val=11; if(strcmp("December",string)==0) val=12; } } void secpage::highlight(int x1,int y1,int x2,int y2,char * month) { getmousestatus(); while(button==0 && x>x1 && x<x2 && y>y1 && y<y2) { setcolor(LIGHTGREEN); rectangle(x1,y1,x2,y2); outtextxy(93,y1,month); getmousestatus(); } hidemouse(); c1(); showmouse(); } void secpage :: place_in_bar3d(char *mname) { hidemouse(); setcolor(15); setfillstyle(1,0); // box for month bar3d(83,38,154,54,0,0); setcolor(LIGHTGREEN); // color of month in the above bar3d outtextxy(93,39,mname); setcolor(0); setfillstyle(1,0); bar3d(83,55,168,212,0,0); showmouse(); } void secpage :: cursor(int length) { while(!kbhit()) { setcolor(WHITE); line(262+length,52,269+length,52); delay(150); setcolor(BLUE); line(262+length,52,269+length,52); delay(150); getmousestatus(); if(button==1) break; } } void secpage :: getyear() { text[0]='

Related Source Codes

Script Name Author
Moving ball screen saver karlmarx
The Classic Game of Snake & Ladder Lakshmi Narayana .A
Railway seat reservation question which comes in sapient VyomWorld
To calculate percentile Ravi Mathur
Send to folder ANIMESH SAHU
Analog clock and calendar Nazia & Rida
HIGH/LOW GAME MOLLY ARORA
Data structure (stack Implimentation) Swapnil B Adsure
Memory Game AnirudhSanyal
Easy Calc Anirudh Sanyal
GK Quiz Anirudh Sanyal
Hangman Game Manish Jain
Snakeman Manish Jain
Full month Calendar Nigi
Cursor shapes nigi

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




Google Groups 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.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1052


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review