设为首页 加入收藏

TOP

新人写的通讯录和简短日历(四)
2015-01-22 21:12:32 来源: 作者: 【 】 浏览:71
Tags:新人 通讯录 简短 日历
"\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();
}
首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇[程序示例]Objective-C中的委托设.. 下一篇c程序的启动过程的反汇编分析

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: