Calendar written in pure C Language

Source: Internet
Author: User

# Include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
Int a [31] = {, 31 }; int main () {int Leap (int); int Month (int); void print (int k, int t, int day); int I, j = 0, k, m, n, t =-6; int day; int total = 1; printf ("Enter the year:"); scanf ("% d", & m ); printf ("Enter the month:"); scanf ("% d", & n); getchar (); do {system ("cls "); printf ("% d month: \ n", m, n); total = 365 * (m-1); for (I = 1; I
     
      
1) total --; if (total = 0) k = (total + 1) % 7; elsek = (total + 2) % 7; print (k, t, day); printf ("select:"); switch (getch () {case '>': if (n = 12) {m ++; n = 1;} elsen ++; break; case '<': if (n = 1) {m --; n = 12;} else n --; break; case '? ': Printf ("Enter year:"); scanf ("% d", & m); printf ("Enter month:"); scanf ("% d ", & n); break; case '#': j = 1; break;} if (j = 1) break; putchar (10) ;}while (1 ); return 0;} int Month (int n) {int day; switch (n) {case 1: case 3: case 5: case 7: case 8: case 10: case 12: day = 31; break; case 2: day = 28; break; case 4: case 6: case 9: case 11: day = 30; break; default: printf ("the month you entered is incorrect. Please enter it again! \ N ") ;}return day ;}int Leap (int m) {// return 1 for a Leap year; otherwise, return 0. Int I = 0; if (m % 4 = 0 & m % 100! = 0 | m % 400 = 0) I = 1; return I;} void print (int k, int t, int day) {FILE * fp; if (fp = fopen ("abc.txt", "w") = 0) {printf ("failed to open \ n"); exit (1);} int I; printf ("\ n October 5, 6, 6 \ n"); fprintf (fp, "\ n October 5, 6, 6 \ n"); printf ("audio \ n "); fprintf (fp, "------------------------------------------------------- \ n"); for (I = 1; I <= k; I ++) {printf (""); fprintf (fp, "") ;}for (I = 0; I
      
        Next month \ n "); printf (" <previous month \ n "); printf ("? Custom year/year \ n "); printf (" # exit \ n "); printf (" ------------------------ \ n "); fclose (fp );}
      
     
    
   
  
 

Related Article

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.