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

Home » C Home » Beginners / Lab Assignments Home » Calender

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

Search Projects & Source Codes:

Title Calender
Author Ravinder Saini
Author Email ravindersaini007 [at] hotmail.com
Description A source code of calender of any year or month.
Category C » Beginners / Lab Assignments
Hits 382122
Code Select and Copy the Code
#include"stdio.h" #include"conio.h" #include<dos.h> #include<stdlib.h> #include<iostream.h> int month(int,int,int); int yea(int); void cal(int,int); void print(int,int); void main() { int g,year,h; char ch,mu='y'; clrscr(); mos: clrscr(); cout<<" INSTRUCTION FOR FINDING MONTH OF ANY YEAR"; cout<<" ENTER MONTH IN LETTER AND YEAR ONWARDS 0000"; cout<<" CALENDER IS CREATED BY RAVINDER SAINI"; printf(" PLEASE ENTER MONTH:="); scanf("%d",&g); printf(" NOW ENTER YEAR:="); scanf("%d",&year); printf(" FIND"); for(h=0;h<=3;h++) { printf(" ."); delay(100); } cal(g,year); while(mu=='y') { ch=getch(); if(ch=='n') { if(g==12) { year+=1; g=1; cal(g,year); } g+=1; cal(g,year); } else if(ch=='p') { if(g==1) { year-=1; g=13; cal(g,year); } g-=1; cal(g,year); } else if(ch=='m') { year+=1; cal(g,year); } else if(ch=='b') { year-=1; cal(g,year); } else if(ch=='c') goto mos; else if(ch=='q') { exit(0); } } fflush(stdin); getch(); } void cal(int g,int year) { int n,o,i; clrscr(); cout<<" TO FIND NEXT YEAR PRESS M"; cout<<" TO FIND PREVIOUS YEAR PRESS B"; cout<<" TO FIND NEXT MONTH PRESS N"; cout<<" TO FIND PREVIOUS MONTH PRESS P"; cout<<" TO EXIT PRESS Q"; printf(" MONTH %d",g); printf(" YEAR %d",year); n=yea(year); o=month(g,year,n); if((g==1)||(g==3)||(g==5)||(g==7)||(g==8)||(g==10)||(g==12)) { print(31,o); } else if((g==4)||(g==6)||(g==9)||(g==11)) { print(30,o); } else if(g==2) { if(year%4==0) print(29,o); else print(28,o); } } int yea(int year) { int i,k,n; unsigned long int m,j; for(i=0;i<year;i++) { if(i%4==0) { m=m+366; } else m=m+365; } j=m+7; k=j%7; n=k%7; switch(n) { case 0: n=1; break; case 1: n=2; break; case 2: n=3; break; case 3: n=4; break; case 4: n=5; break; case 5: n=6; break; case 6: n=0; break; } return(n); } int month(int g,int year,int n) { int j,o; for(j=1;j<g;j++) { if((j==1)||(j==3)||(j==5)||(j==7)||(j==8)||(j==10)) n=n+31; else if((j==4)||(j==6)||(j==9)||(j==11)) n=n+30; else if(j==2) { if(year%4==0) { n=n+29; continue; } else n=n+28; continue; } } o=n%7; return(o); } void print(int p,int q) { int i,j,l=0; printf(" "); printf("MON TUE WED THU FRI SAT SUN "); while(l!=q) { printf(" "); l++; } for(i=1;i<=p;i++) { printf("%d ",i); q++; if(q==7) { printf(" "); q=0; } } }

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




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=703


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