Calendar program

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2007
Posts: 2
Reputation: janxxx is an unknown quantity at this point 
Solved Threads: 0
janxxx janxxx is offline Offline
Newbie Poster

Calendar program

 
0
  #1
Oct 4th, 2007
Can u help me in my assignment in making a calendar program using turbo c.
I have made a few functions but im now stuck. What will I do with this?

User is asked to input year and month, then the out put will be the year and the Calendar of the month inputed...

pls help me.. asap





#include<stdio.h>

void printMonth (int startDay, int days);

int main (void)
{
printfMonth(2,29);
return 0;
}

/*======printMonth===========*/

void printMonth (int startDay, int days)

{
int weekDay;
int dayCount = 0;
{
printf("Sun Mon Tue Wed Thu Fri Sat\n");
printf("--- --- --- --- --- --- ---\n");

for (weekDay= 0; weekDay < startDay; weekDay++)
{printf(" ");}

for (int dayCount = 1; dayCount <= days; dayCount++)
{
if (weekDay > 6)
{
printf("\n");
weekDay = 1;
}
else
weekDay++;
printf("%3d", daycount);
}
printf("\n--- --- --- --- --- --- ---\n");
return;
}}
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 2
Reputation: janxxx is an unknown quantity at this point 
Solved Threads: 0
janxxx janxxx is offline Offline
Newbie Poster

Re: Calendar program

 
0
  #2
Oct 4th, 2007
i hope i can recieve a reply today... plssss
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Calendar program

 
0
  #3
Oct 4th, 2007
First of all, read this. Then explain what your problem is, don't make us try to guess. And be patient. We all have lives and don't live here at DaniWeb -- 13 minutes is not an appropriate length of time to get demanding.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1
Reputation: vij is an unknown quantity at this point 
Solved Threads: 0
vij vij is offline Offline
Newbie Poster

Re: Calendar program

 
0
  #4
Oct 5th, 2007
what to do if folder options is not there in yhe taskbar
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 10
Reputation: restrooms is an unknown quantity at this point 
Solved Threads: 0
restrooms restrooms is offline Offline
Newbie Poster

Re: Calendar program

 
0
  #5
Oct 8th, 2007
Originally Posted by janxxx View Post
Can u help me in my assignment in making a calendar program using turbo c.
I have made a few functions but im now stuck. What will I do with this?

User is asked to input year and month, then the out put will be the year and the Calendar of the month inputed...

pls help me.. asap





#include<stdio.h>

void printMonth (int startDay, int days);

int main (void)
{
printfMonth(2,29);
return 0;
}

/*======printMonth===========*/

void printMonth (int startDay, int days)

{
int weekDay;
int dayCount = 0;
{
printf("Sun Mon Tue Wed Thu Fri Sat\n");
printf("--- --- --- --- --- --- ---\n");

for (weekDay= 0; weekDay < startDay; weekDay++)
{printf(" ");}

for (int dayCount = 1; dayCount <= days; dayCount++)
{
if (weekDay > 6)
{
printf("\n");
weekDay = 1;
}
else
weekDay++;
printf("%3d", daycount);
}
printf("\n--- --- --- --- --- --- ---\n");
return;
}}
try this if it can help its a calendar program.


#include <stdio.h>
#include <conio.h>
int a,b,c;
int main()
{
clrscr();
printf("Enter Number:");
scanf("%d",&c);
switch(c)
{
case 1:
printf("\t\t\tJanuary 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t1\t2\t3\t4\t5\t6\n\n");
printf("\t7\t8\t9\t10\t11\t12\t13\n\n");
printf("\t14\t15\t16\t17\t18\t19\t20\n\n");
printf("\t21\t22\t23\t24\t25\t26\t27\n\n");
printf("\t28\t29\t30\t31\n\n");break;

case 2:
printf("\t\t\tFebruary 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t\t1\t2\t3\n\n");
printf("\t4\t5\t6\t7\t6\t9\t10\n\n");
printf("\t11\t12\t13\t14\t15\t16\t17\n\n");
printf("\t18\t19\t20\t21\t22\t23\t24\n\n");
printf("\t25\t26\t27\t28\n\n");break;

case 3:
printf("\t\t\tMarch 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}printf("\t\t\t\t\t1\t2\t3\n\n");
printf("\t4\t5\t6\t7\t6\t9\t10\n\n");
printf("\t11\t12\t13\t14\t15\t16\t17\n\n");
printf("\t18\t19\t20\t21\t22\t23\t24\n\n");
printf("\t25\t26\t27\t28\t29\t30\t31\n\n");
break;
case 4:
printf("\t\t\tApril 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t1\t2\t3\t4\t5\t6\t7\n\n");
printf("\t8\t9\t10\t11\t12\t13\t14\n\n");
printf("\t15\t16\t17\t18\t19\t20\t21\n\n");
printf("\t22\t23\t24\t25\t26\t27\t28\n\n");
printf("\t29\t30\n\n");break;

case 5:
printf("\t\t\tMay 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t1\t2\t3\t4\t5\n\n");
printf("\t6\t7\t8\t9\t10\t11\t12\n\n");
printf("\t13\t14\t15\t16\t17\t18\t19\n\n");
printf("\t20\t21\t22\t23\t24\t25\t26\n\n");
printf("\t27\t28\t29\t30\n\n");break;

case 6:
printf("\t\t\tJune 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t\t1\t2\t3\n\n");
printf("\t3\t4\t5\t6\t7\t8\t9\n\n");
printf("\t10\t11\t12\t13\t14\t15\t16\n\n");
printf("\t17\t18\t19\t20\t21\t22\t23\n\n");
printf("\t24\t25\t26\t27\t28\t29\t30\n\n");break;

case 7:
printf("\t\t\tJuly 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t1\t2\t3\t4\t5\t6\t7\n\n");
printf("\t8\t9\t10\t11\t12\t13\t14\n\n");
printf("\t15\t16\t17\t18\t19\t20\t21\n\n");
printf("\t22\t23\t24\t25\t26\t27\t28\n\n");
printf("\t29\t30\t31\n\n");break;

case 8:
printf("\t\t\tAugust 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t1\t2\t3\t4\n\n");
printf("\t5\t6\t7\t8\t9\t10\t11\n\n");
printf("\t12\t13\t14\t15\t16\t17\t18\n\n");
printf("\t19\t20\t21\t22\t23\t24\t25\n\n");
printf("\t26\t27\t28\t29\t30\t31\n\n");break;

case 9:
printf("\t\t\tSeptember 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t\t\t\t1\n\n");
printf("\t2\t3\t4\t5\t6\t7\t8\n\n");
printf("\t9\t10\t11\t12\t13\t14\t15\n\n");
printf("\t16\t17\t18\t19\t20\t21\t22\n\n");
printf("\t23\t24\t25\t26\t27\t28\t29\n\n");
printf("\t30"); break;

case 10:
printf("\t\t\tOctober 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t1\t2\t3\t4\t5\t6\n\n");
printf("\t7\t8\t9\t10\t11\t12\t13\n\n");
printf("\t14\t15\t16\t17\t18\t19\t20\n\n");
printf("\t21\t22\t23\t24\t25\t26\t27\n\n");
printf("\t28\t29\t30\t31\n\n");break;

case 11:
printf("\t\t\tNovember 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t\t1\t2\t3\n\n");
printf("\t4\t5\t6\t7\t6\t9\t10\n\n");
printf("\t11\t12\t13\t14\t15\t16\t17\n\n");
printf("\t18\t19\t20\t21\t22\t23\t24\n\n");
printf("\t25\t26\t27\t28\t29\t29\t30\n\n");break;

case 12:
printf("\t\t\tDecember 2007");
printf("\n\t");
for(b=1;b<=51; b++)
{
if(b==51)
printf("=\n");
else
printf("=");
gotoxy(9,3); printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n\t");
for(b=1;b<=51;b++)
{
if(b==51)
printf("=\n");
else
printf("=");
}
printf("\t\t\t\t\t\t\t1\n\n");
printf("\t2\t3\t4\t5\t6\t7\t8\n\n");
printf("\t9\t10\t11\t12\t13\t14\t15\n\n");
printf("\t16\t17\t18\t19\t20\t21\t22\n\n");
printf("\t23\t24\t25\t26\t27\t28\t29\n\n");
printf("\t30");
break;
} } } } } } } } } } } }
getch();
return 0;
}}
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Calendar program

 
0
  #6
Oct 8th, 2007
What a horrible unformatted mess that is, which is only good for a DOS compiler for one specific year.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2
Reputation: fromme is an unknown quantity at this point 
Solved Threads: 0
fromme fromme is offline Offline
Newbie Poster

Re: Calendar program.... Fromme

 
0
  #7
Nov 15th, 2007
this pogram will give u th day othe dd/mm/yy or the dates of day/mm/yy
try... its simple program... n reply to
vivek.es2386@gmail.com

#include<stdio.h>
#include<conio.h>
#define leap(y) ((y%4==0)&&(y%400!=0))

void find_day(int o)
{
switch(o)
{
case 0:printf("sunday");
break;
case 1:printf("monday");
break;
case 2:printf("tuesday");
break;
case 3:printf("wednesday");
break;
case 4:printf("thursday");
break;
case 5:printf("friday");
break;
default:printf("saturday");
break;
}
}


void main()
{
int i,j,p,dd,dy,mm,xy,yy,flag,oy,od=0,leap,m,n;
int year[]={31,28,31,30,31,30,31,31,30,31,30,31};
char ch;
clrscr();

printf(" enter '1' if ur entering dd/mm/yy or");
printf("\n enter '2' if ur entering day/mm/yy:");
ch=getche();
clrscr();
if(ch=='1')
{
printf("\n enter date:");
scanf("%d",&dd);
printf("\n enter month:");
scanf("%d",&mm);
printf("\n enter year:");
scanf("%d",&yy);
flag=1;
}

else if(ch=='2')
{
printf("\n enter day:");
printf("enter 0-Sun, 1-Mon, 2-Tue, 3-wed, 4-Thurs, 5-Fri, 6-sat:");
scanf("%d",&dy);
printf("\n enter month:");
scanf("%d",&mm);
printf("\n enter year:");
scanf("%d",&yy);
flag=0;
}
else
printf("enter invalid input");

xy=yy-1;
m=xy/400;
n=xy-400*m;

if(n>100)
{
p=n/100;
od=p*5;
n=n%100;
}

leap=n/4;
oy=n-leap;
od=od+leap*2+oy;
od=od%7;

printf("m=%d\nn=%d\noy=%d\nleap=%d\nod=%d",m,n,oy,leap,od);
getch();

for(i=0;i<(mm-1);i++)
od=od+year[i];

printf("\nmonth od=%d",od);
getch();

if(flag==1)
od=od+dd;
else
od++;

if((leap(yy))&&(m>2))
{
printf("\n its a leap year");
od++;
}

od=od%7;
printf("\ndate odd day:%d",od);
getch();

if(flag==1)
{
printf("\n The day is:");
find_day(od);
getch();
}


int k=1;
if(flag==0)
{
while((od!=dy) && (k!=31))
{
k++;
od++;
od=od%7;
}
printf("\n odd day=%d:",k);
getch();

printf("\n The dates tat fall on tis days r:");
find_day(od);

while(k<32)
{
printf("\n%d",k);
k=k+7;
if(mm==2 && k>=28)
break;
}
getch();
}

printf("\n want to continue?:y/n");
if(getche()=='y')
main();

}
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Calendar program

 
0
  #8
Nov 15th, 2007
Do you honestly think that that unformatted code is going to be helpful over a month later?
And what is so difficult in understanding the post titled Read Me: Read This Before Posting? Is it not explicit enough?
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Calendar program

 
0
  #9
Nov 15th, 2007
<laurel>That's another fine unformatted mess you've posted</hardy>
Not to mention
- using void main,
- using meaningless single letter identifiers,
- using obsolete headers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC