C calendar !!

Source: Internet
Author: User

# Include "stdio. H" <br/> int isleapyear (INT year) <br/>{< br/> If (Year % 4! = 0 | year % 100 = 0) & (Year % 400! = 0) <br/> return 0; <br/> else <br/> return 1; <br/>}< br/> int firstdayofyear (INT year) <br/> {<br/> return (Year + (year-1)/4 + (year-1)/400-(year-1)/100) % 7; <br/>}< br/> main () <br/> {<br/> char * monthname [13] = {"", "August ", "August ", "August", "August", "August" };< br/> int numday_month [13] =, 31 }; <br/> int firstday_month [13]; <br/> int workarray [13]; <br/> int year; <br/> char ch; <br/> int I, m, n; <br/> DO <br/> {<br/> system ("CLS "); // clear screen effect <br/> printf ("/N"); <br/> printf ("/N "); <br/> printf ("/N"); <br/> printf ("/N "); <br/> printf ("Enter the year to be queried:"); </P> <p> scanf ("% d", & year ); </P> <p> If (isleapyear (year) <br/> numday_month [2] = 29; </P> <p> firstday_month [1] = firstdayofyear (year); <br/> for (I = 2; I <= 12; I ++) <br/> firstday_month [I] = (firstday_month [I-1] + numday_month [I-1]) % 7; <br/> for (I = 1; I <= 12; I ++) <br/> workarray [I] =-firstday_month [I]; </P> <p> printf ("% 34 S ",""); <br/> printf ("Year % d/N", year); <br/> for (I = 1; I <= 12; I ++) <br/>{< br/> printf ("/N"); <br/> printf ("% 32 s/n", monthname [I]); <br/> // printf ("% 22 s ",""); <br/> printf ("Sunday/T Monday/t Tuesday/T Wednesday/T Friday/T Saturday/N "); <br/> for (M = 1; m <= 6; m ++) <br/> {<br/> // printf ("% 18 s ", ""); <br/> for (n = 1; n <= 7; n ++) <br/> {<br/> workarray [I] ++; <br/> If (workarray [I]> 0 & workarray [I] <= numday_month [I]) <br/> printf ("% d/T ", workarray [I]); <br/> else <br/> printf ("/t"); <br/>}< br/> printf ("/N "); <br/>}</P> <p> system ("pause "); <br/>}< br/> printf ("/n whether to continue to press y/y and other keys to exit the system :"); <br/> scanf ("% C", & Ch); <br/>}while (CH = 'y' | CH = 'y '); <br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.