C language to write multi function calendar
- 2020-04-02 03:01:03
- OfStack
The first code I Shared is for Suggestions for improvements. My 3 and 4 functions are empty.
The first time to upload the code
*** and why I upload the code so on the wrong, vc++6.0 is very good ah?? For example, some code is uploaded in the other code is not uniform specifications.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<windows.h>
#define H "%d",&y //This is a boring thing to do. Just write it down.
daoshu()
{
int i=1,j;
int k=0;
system("cls"); //The function is to clear the screen with the function of #include<Stdlib. H>
while(i<=7)
{ printf(" Please wait a moment ");
for(j=1;j<=i;j++) //This is the ellipsis loop
{
printf(".");
}
k++;
if(k==3)
{
i=0;
}
Sleep(400);
system("cls");
i++;
}
}
one()
{
int y;
int i,k,s=1;//Cycle number
int j;//Set the maximum of one month to 31 days
printf("n Please enter the number of years to display ( Format: xxxx years ):");
scanf(H); //Scanf (""%d",&y");
daoshu();//Call a function
printf("%d years n",y);
if(y%400==0 || y%4==0 && y%100!=0)//Is it a leap year (yes)
{
for(i=1;i<=12;i++)
{ j=31;//Initialization days
if(i%2==0)
{j=30;}
if(i%2!=0)
{j=31;}
if(i==2)
{j=j-1;}
if(i==8)//Even Numbers alone make August 31 days
{j=31;}
printf("n******%d month ******n",i);
printf("n Monday t Tuesday t Wednesday t Thursday t Friday t Saturday t Sunday n");
for(k=1;k<=j;k++)
{
s++;
printf("t%d",k);
if(s%7==0)//The initial value is 1 when 7 is a newline
{ printf("n");}
}
printf("n========================================n");
}
}
else//Not a leap year
{
for(i=1;i<=12;i++)
{ j=31;//Initialization days
if(i%2==0)
{j=30;}
if(i%2!=0)
{j=31;}
if(i==2)
{j=j-2;}
if(i==8)//Even Numbers alone make August 31 days
{j=31;}
printf("n******%d month ******n",i);
printf("n Monday t Tuesday t Wednesday t Thursday t Friday t Saturday t Sunday n");
for(k=1;k<=j;k++)
{ s++;
printf("t%d",k);
if(s%7==0)
{printf("n");}
}
printf("n========================================n");
}
}
}
////////////////////////////////////////////////////////////(undeveloped function reference module)
ttc()
{
printf("n Function undeveloped !! Stay tuned for .n");
}
////////////////////////////////////////////////////////////(undeveloped function reference module)
two()
{
int x;
printf("n Please enter the year you want to view: ");
scanf("%d",&x);
if(x%400==0 || x%4==0 && x%100!=0)
{
printf("n This year is a leap year !!!n");
}
else
printf("nNot a leap year!!!");
}
//The menu
main()
{
int x;//Option number
char n[5],y[5]="y";//Whether to continue operation
int a[100];
printf(" Ten thousand calendar n");
Loop:
printf("1. print xxxx Year month n");
printf("2. judge xxxx Is year a leap year n");
printf("3.***n");
printf("4.***n");
printf("5.exitn");
printf("6. Whether the CLS n");
system("color 3f");//This means a light white font with a light green background
printf("n The serial number (1~5):");
scanf("%d",&x);
switch(x)
{
case 1: {one();break;}
case 2: {two();break;}
case 3: {ttc();break;}
case 4: {ttc();break;}
CII: case 5: {printf("( Chinese translation ) Please press any key exit!!!n( The English translation )");exit(0);}
case 6:{system("cls");break;}
default :printf("n Please enter the 1~5 The serial number (function block)!! ");
}
printf("nnWhether to continue operation(Y/N) ");
scanf("%s",&n);
if(strcmp(n,y)==0)
{
system("cls");
goto Loop;//Jump to Loop:
}
else
{
goto CII;//Jump to the SEC:
exit(0);//exit
}
}
Above is the article to share the C language written multi-functional calendar code, although not perfect, but still want to recommend to you, I hope you can like.