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;
}}

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.

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;
}}

What a horrible unformatted mess that is, which is only good for a DOS compiler for one specific year.

this pogram will give u th day othe dd/mm/yy or the dates of day/mm/yy
try... its simple program... n reply tovivek.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;


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();


}

Edited 3 Years Ago by happygeek: fixed formatting

<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

This article has been dead for over six months. Start a new discussion instead.