"\t\t\t[3]exit");
? ? ? ? printf("please enter the number to select function what you want to executive:[ ]\b\b");
}
void ExecutiveFunction2(int *a)
{
? ? ? ? switch(*a)
? ? ? ? {
? ? ? ? case 1:
? ? ? ? ? ? ? ? Display();
? ? ? ? ? ? ? ? break;
? ? ? ? case 2:
? ? ? ? ? ? ? ? Search();
? ? ? ? ? ? ? ? break;
? ? ? ? case 3:
? ? ? ? ? ? ? ? exit(0);
? ? ? ? ? ? ? ? break;
? ? ? ? }
}
void InterfaceOfAdministratorPrivilege()
{
? ? ? ? do
? ? ? ? {
? ? ? ? ? ? ? ? int a, *p;
? ? ? ? ? ? ? ? p=&a;
? ? ? ?? ???AdministratorInterface();
? ? ? ? ? ? SelectOption(p);
? ?? ???ExecutiveFunction1(p);
? ? ? ? }while(1);
}
void InterfaceOfNormalUserPrivilege()
{
? ? ? ? do
? ? ? ? {
? ? ? ? ? ? ? ? int a, *p;
? ? ? ? ? ? ? ? p=&a;
? ? ? ?? ???NormalUserInterface();
? ? ? ?? ???SelectOption(p);
? ?? ???ExecutiveFunction2(p);
? ? ? ? }while(1);
}
void main()
{
? ? ? ? char a[10], b[10], c[10];
? ? initialization_pas=a;
? ? ? ? password_you_entered=b;
? ? ? ? password_you_entering=c;
? ? InitializationPassword();
? ? ? ? EnterPassword();
? ? ? ??
? ? ? ? if((strcmp(initialization_pas,password_you_entering)==0) || (strcmp(password_you_entered,password_you_entering)==0))
? ? ? ? {
? ? ? ? ? ? ? ? puts("the password is right!!!\nyou will enter the administrator privilege`s contacts!!!");
? ? ? ? ? ? ? ? getch();
? ? ? ? ? ? ? ? InterfaceOfAdministratorPrivilege();
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? ? ? puts("the password is wrong!!!\nyou will enter the normal user privilege`s contacts!!!");
? ? ? ? ? ? ? ? getch();
? ? ? ? ? ? ? ? InterfaceOfNormalUserPrivilege();
? ? ? ? }
}
**********************************************************************************
#include
static int year,month,days;
static int moon[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i;
/*全局变量和函数对位置有顺序的要求*/
void EnterDate()
{
? ? puts("yyyy.mm");
? ? ? ? scanf("%d.%d",&year,&month);
}
void CheckDate()
{
? ? ? ? if(year>=1900 && month>=1 && month<=12)
? ?? ???puts("The date is qualified");
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? ? ? puts("The date entered is not qualified,please input it again.");
? ? ? ? ? ? ? ? EnterDate();
? ? ? ? }
}
void EnterAndCheckDate()
{
? ? ? ?? ???EnterDate();
? ? ? ?? ???CheckDate();
}
void February()
{
? ? ? ? if(year%4==0 && year%100!=0 || year%400==0)
? ? ? ? ? ? ? ? moon[2]=29;
? ? ? ? else
? ? ? ? ? ? ? ? moon[2]=28;
}
void TotalDays()
{
? ? ? ? days=1;
? ? ? ? for(i=1900;i ? ? ? ? {
? ?? ???if(i%4==0 && i%100!=0 || i%400==0)
? ? ? ?? ?? ?? ? ? ? days+=366;
? ? ? ? ? ? else
? ? ? ?? ???? ? ? ? days+=365;
? ? ? ? }
? ? for(i=1;i ? ? ? ? ? ? ? ? days+=moon[i];
}
void Calendar ()
{
? ? ? ? puts("SUM\tMON\tTUE\tWED\tTRE\tFRI\tSAT");
? ? ? ? for(i=days%7;i>0;i--)
? ? ? ? ? ? ? ? printf("\t");
}
void Showing()
{
? ? ? ? for(i=1;i<=moon[month];i++)
? ? ? ? {
? ? ? ? ? ? ? ? printf("%d",i);
? ? ? ? ? ? ? ? if(days%7==6)
? ? ? ? ? ? ? ?? ???puts("");
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? ? printf("\t");
? ? ? ? ? ? ? ? days++;
? ? ? ? }
? ? ? ? puts("");
}
void DisplayTheCalendar()
{
? ? ? ? February();
? ? ? ? TotalDays();
? ? ? ? Calendar ();
? ? ? ? Showing();
}
void main()
{
? ??
? ? EnterAndCheckDate();
? ? ? ? DisplayTheCalendar();
}
|