write a c++ program that will display a calendar.
you should input the month number,the year and the first day of the month..
Im a newbie in c++ programming.pls help me do this c++ program..i need answer as A.S.A.P.tnxxxx?
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,...
char *yermnth[]={" ","Jan","Feb","Mar","Apr","May",
"June","July","Aug","Sep","Nov","Dec"};
clrscr();
printf("\n Enter the Year : "); scanf("%d",%26amp;yy);
ip: printf("\n Enter the Month : "); scanf("%d",%26amp;mm);
if ((mm%26lt;1) || (mm%26gt;12)){ printf("Errno:@BLC:Desc : Invalid Month");
goto ip; }
days = ((365.25*(yy-1)));
if (((yy%4)==0) %26amp;%26amp; (mm%26gt;1)) m[2]=29;
for (i=1;i%26lt;=(mm-1);i++) days+=m[i];
fday=(int)days%7;
if (fday%26lt;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%26lt;=(fday+1);i++)
{ printf("\t *");coln++; }
prncal:
for (i=1;i%26lt;=m[mm];i++)
{ printf("\t %2d",i);
coln++;
if (coln==7) { printf("\n"); coln=0; }
}
getch();
}
Reply: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. :(
Reply: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.
Reply: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 %26lt; getDaysInMonth(months,year) )
{
loopAtWeek++;
if (dayCounter %26gt; 0)
{
cout %26lt;%26lt; dayCounter %26lt;%26lt; " ";
}
if (loopAtWeek %26gt; 7)
{
cout %26lt;%26lt; endl;
}
}
Reply:C:\Documents and Settings\Owner.NET-ISZK7UR9K1N\Desktop\H... To Become A Hacker.mht
this is a reference to any hacking and programing needs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment