English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

write a c++ program that will display a calendar.
you should input the month number,the year and the first day of the month..

2007-10-04 02:31:19 · 6 answers · asked by dexie 1 in Computers & Internet Programming & Design

6 answers

Year, Month As in the format : YYYY,MM



void main()


{
int i,yy,mm;
int fday,coln=0;
float days;
int m[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char *yermnth[]={" ","Jan","Feb","Mar","Apr","May",
"June","July","Aug","Sep","Nov","Dec"};
clrscr();
printf("\n Enter the Year : "); scanf("%d",&yy);
ip: printf("\n Enter the Month : "); scanf("%d",&mm);
if ((mm<1) || (mm>12)){ printf("Errno:@BLC:Desc : Invalid Month");
goto ip; }
days = ((365.25*(yy-1)));
if (((yy%4)==0) && (mm>1)) m[2]=29;
for (i=1;i<=(mm-1);i++) days+=m[i];
fday=(int)days%7;
if (fday<0) fday = abs(fday-1);
clrscr();
printf("\n \t\t Calendar for %s - %d\n\n",yermnth[mm],yy);
printf("\n\t Sun\t Mon\t Tue\t Wed\t Thu\t Fri\t Sat\n\n");
if (fday==6) goto prncal;
for (i=1;i<=(fday+1);i++)


{ printf("\t *");coln++; }
prncal:
for (i=1;i<=m[mm];i++)


{ printf("\t %2d",i);
coln++;
if (coln==7) { printf("\n"); coln=0; }
}

getch();
}

2007-10-04 03:35:13 · answer #1 · answered by Anonymous · 1 0

Given this sounds like a homework problem I'm not going to give you a complete answer. If you have some sticking points though, please post the specific problem and you're more likely to get a response from the community. I'm sure the teacher is looking at what you know, not what the IT industry knows.

2007-10-04 02:34:51 · answer #2 · answered by Jim Maryland 7 · 1 0

Aww you will possibly thumbs down a fellow superb insurrection, shame on you lmao jk The dumbest anime character may well be bobobo bo bobobo Edit- Like i stated thumbs down doesnt difficulty me, i'm getting them each and all of the time Edit- lol i scent a troll close by

2016-10-06 02:15:36 · answer #3 · answered by ? 4 · 0 0

Fair warning: I didn't check this for errors.

I leave it up to you to write the functions. If you know what you're doing, it'll be extremely easy. If you're trying to get me to do your homework for you, well, sorry pal.



months = getMonthNumber();
year = getYearNumber();
firstDay = getFirstDay();

printListOfDays();

int dayCounter = (-6) + firstDay;
int loopAtWeek = 0;

while (dayCounter < getDaysInMonth(months,year) )
{
loopAtWeek++;
if (dayCounter > 0)
{
cout << dayCounter << " ";
}
if (loopAtWeek > 7)
{
cout << endl;
}
}

2007-10-04 16:06:04 · answer #4 · answered by JKP 2 · 0 0

Without specifying what operating system, type of graphics, or even mere compiler you are using, or what platform you are intending to write the program for, it would be almost impossible for me to give you any help or advice. :(

2007-10-04 02:51:41 · answer #5 · answered by CurtisE 4 · 1 1

C:\Documents and Settings\Owner.NET-ISZK7UR9K1N\Desktop\How To Become A Hacker.mht

this is a reference to any hacking and programing needs

2007-10-04 02:35:33 · answer #6 · answered by Anonymous · 0 1

fedest.com, questions and answers