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

Home » C Home » Beginners / Lab Assignments Home » Finding a day of the given date with month's calender (Mini Project)

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

Search Projects & Source Codes:

Title Finding a day of the given date with month's calender (Mini Project)
Author Raji
Author Email rajesh_ [at] myself.com
Description With this prg. u can find the day on the entered date. There are no errors at all u can do while entering the date. this was the task given to me by my computer lecturer Mr.Kashish Shukla.
as a timepass for vaccation . (M.P.Christian college of engg. and technology, Bhilai)(tested in turbo c++ compiler)
Category C » Beginners / Lab Assignments
Hits 365577
Code Select and Copy the Code
Code : #include<stdio.h> #include<conio.h> #include<process.h> #include<dos.h> void main() { long int n=0,i,z1=0,z2=0,z3=0,r1=0,r2=0,r3=0,d=0,m=0,y=0,nod1=0,j; long int s=0,p=0,s1=0,p1=0,p2=0,leap=0,lp=0,x=0,days=0,lpg=0,ch=0,st=0; clrscr(); textcolor(11); gotoxy(15,4); cprintf("FIND OUT THE DAY ON THE DATE ENTERED BY YOU"); gotoxy(16,6); cprintf("ENTER THE DATE IN THIS FORMAT (15 10 2005)"); delay(1000); gotoxy(25,10); textcolor(9); cprintf("ENTER THE DATE :"); scanf(" %ld %ld %ld",&d,&m,&y); fflush(stdin); clrscr(); textcolor(15); gotoxy(10,20); cprintf("LOADING "); for(j=1;j<50;j++) { delay(150); cprintf("%c",219); } delay(2000); clrscr(); //........................CHECKING FOR WRONG DATE...................... if(y<1900) { gotoxy(15,18); printf("THE DATE ENTERED IS OUT OF COMPUTER'S MEMORY"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } if(m>12||m<1) { gotoxy(15,18); printf("INVALID DATE !! PLEASE ENTER A VALID DATE"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } if(d<1) { gotoxy(15,18); printf("INVALID DATE !! PLEASE ENTER A VALID DATE"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } if(((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)||(m==12))&&(d>31)) { gotoxy(15,18); printf("INVALID DATE !! PLEASE ENTER A VALID DATE"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } if(((m==4)||(m==6)||(m==9)||(m==11))&&(d>30)) { gotoxy(15,18); printf("INVALID DATE !! PLEASE ENTER A VALID DATE"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } //.......................CHECKING FOR WRONG DATE IS OVER............... x=y; s=y-1900; p=s*365; for(i=1900;i<x;i++) { r1=i%4; r2=i%400; r3=i%100; if((r2==0)||((r3!=0)&&(r1==0))) { leap=leap+1; } } days=leap+p; for(s1=0;s1<m;s1++) { if((s1==1)||(s1==3)||(s1==5)||(s1==7)||(s1==8)||(s1==10)||(s1==12)) { p1=p1+31; } else if((s1==4)||(s1==6)||(s1==9)||(s1==11)) { p2=p2+30; } else if(s1==2) { z1=y%4; z2=y%400; z3=y%100; if((z2==0)||((z3!=0)&&(z1==0))) lp=29; else lp=28; } } //.....................CHECKING FOR WRONG DATE FOR FEBRUARY............... if((y%400==0)||((y%100!=0)&&(y%4==0))) { lpg=29; } else lpg=28; if((m==2)&&(d>lpg)) { gotoxy(15,18); printf("INVALID DATE !! PLEASE ENTER A VALID DATE"); gotoxy(10,20); textcolor(4); cprintf("EXITING "); for(j=1;j<50;j++) { delay(200); cprintf("%c",222); } exit(0); } //.....................CHECKING IS OVER.................................. nod1=p1+p2+lp+days+(d-1); n=nod1%7; st=p1+p2+lp+days; ch=st%7; gotoxy(30,5); textcolor(9); switch(m) { case 1: cprintf("JANUARY"); break; case 2: cprintf("FEBRUARY"); break; case 3: cprintf("MARCH"); break; case 4: cprintf("APRIL"); break; case 5: cprintf("MAY"); break; case 6: cprintf("JUNE"); break; case 7: cprintf("JULY"); break; case 8: cprintf("AUGUST"); break; case 9: cprintf("SEPTEMBER"); break; case 10: cprintf("OCTOBER"); break; case 11: cprintf("NOVEMBER"); break; case 12: cprintf("DECEMBER"); break; } textcolor(9); cprintf(" %d",y); printf(" SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY "); textcolor(15); if(ch==6) printf(""); else if(ch==0) printf(" "); else if(ch==1) printf(" "); else if(ch==2) printf(" "); else if(ch==3) printf(" "); else if(ch==4) printf(" "); else if(ch==5) printf(" "); for(i=1;i<=31;i++) { cprintf(" %2d ",i); if((i+ch-1)%7==0) { textcolor(15); cprintf(" "); } if(m==2&&i==lpg) break; if(((m==4)||(m==6)||(m==9)||(m==11))&&i==30) break; } fflush(stdin); fflush(stdout); //..........................PRINTING DAY AT BOTTOM....................... gotoxy(20,20); textcolor(9); cprintf("THE DAY ON %ld/%ld/%ld IS : ",d,m,y); textcolor(11+128); switch(n) { case 0: cprintf("MONDAY"); break; case 1: cprintf("TUESDAY"); break; case 2: cprintf("WEDNESDAY"); break; case 3: cprintf("THURSDAY"); break; case 4: cprintf("FRIDAY"); break; case 5: cprintf("SATURDAY"); break; case 6: cprintf("SUNDAY");break; default: cprintf("ERROR"); } //..........PRINTING DAY AT BOTTOM IS OVER.......... fflush(stdin); fflush(stdout); getch(); }

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


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