#include <stdio.h> //标准输入输出
#include <stdlib.h> //其它操作(杂项)
#include <string.h> //字符串操作
#include <conio.h> //系统输入输出
#include <time.h> //时间相关操作
#define PASSWORD flying
void Pasword();
void Putheart();
int main(int argc,char *argv[])
{
Password();
Putheart();
getchar();
return 0;
}
void Password() //密码验证函数
{
char *pass=NULL; //初始化指针
int i,count;
time_t start,end;
pass=(char *)malloc(255*sizeof(char)); //分配内存
while(1)
{
count=0;
printf("\n\n\n\n\n\t\t\t********************************\n");
printf("\n\t\t UserName:flying \n");
printf("\n\t\t PassWord:");
while((count>=0)&&(pass[count++]=getch())!=13) //密码输入
{
if(pass[0]=='\b')
{
count=0;
continue;
}
else if(pass[count-1]=='\b')
{
printf("%c%c%c",'\b','\0','\b');
count-=2;
}
else
putchar('*');
}
pass[--count]='\0';
if(!strcmp(pass,PASSWORD)) //开始验证
{
printf("\n\n\t\t\t\t\t\tLoading");
for(i=0;i<=25;i++)
{
Sleep(250);
printf(".");
}
system("cls");
printf("\n\n\n\n\n\n\n\n\n\t\t\t");
printf(" 欢 迎 光 临!");
start=time(NULL);
end=time(NULL);
while(end-start<3) //延时3秒执行以下程序
{
end=time(NULL);
}
system("cls");
free(pass); //释放储存密码的内存
return ;
}
free(pass); //释放密码错误的那块内存
pass=(char *)malloc(255*sizeof(char)); //重新分配储存密码内存
system("cls");
printf("\a\n\n\n\n\n\n\n\n\t\t\t\t密 码 错 误 !");
getch();
system("cls");
}
}
void Putheart()
{
printf("\n\n\t\t\t***************************************\n\n");
printf("\n\t\t * * * *");
printf("\n\t\t * * * *");
printf("\n\t\t * *** *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * * ");
printf("\n\t\t *");
printf("\n\n\t\t\t***************************************\n\n");
}
#include <stdlib.h> //其它操作(杂项)
#include <string.h> //字符串操作
#include <conio.h> //系统输入输出
#include <time.h> //时间相关操作
#define PASSWORD flying
void Pasword();
void Putheart();
int main(int argc,char *argv[])
{
Password();
Putheart();
getchar();
return 0;
}
void Password() //密码验证函数
{
char *pass=NULL; //初始化指针
int i,count;
time_t start,end;
pass=(char *)malloc(255*sizeof(char)); //分配内存
while(1)
{
count=0;
printf("\n\n\n\n\n\t\t\t********************************\n");
printf("\n\t\t UserName:flying \n");
printf("\n\t\t PassWord:");
while((count>=0)&&(pass[count++]=getch())!=13) //密码输入
{
if(pass[0]=='\b')
{
count=0;
continue;
}
else if(pass[count-1]=='\b')
{
printf("%c%c%c",'\b','\0','\b');
count-=2;
}
else
putchar('*');
}
pass[--count]='\0';
if(!strcmp(pass,PASSWORD)) //开始验证
{
printf("\n\n\t\t\t\t\t\tLoading");
for(i=0;i<=25;i++)
{
Sleep(250);
printf(".");
}
system("cls");
printf("\n\n\n\n\n\n\n\n\n\t\t\t");
printf(" 欢 迎 光 临!");
start=time(NULL);
end=time(NULL);
while(end-start<3) //延时3秒执行以下程序
{
end=time(NULL);
}
system("cls");
free(pass); //释放储存密码的内存
return ;
}
free(pass); //释放密码错误的那块内存
pass=(char *)malloc(255*sizeof(char)); //重新分配储存密码内存
system("cls");
printf("\a\n\n\n\n\n\n\n\n\t\t\t\t密 码 错 误 !");
getch();
system("cls");
}
}
void Putheart()
{
printf("\n\n\t\t\t***************************************\n\n");
printf("\n\t\t * * * *");
printf("\n\t\t * * * *");
printf("\n\t\t * *** *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * *");
printf("\n\t\t * * ");
printf("\n\t\t *");
printf("\n\n\t\t\t***************************************\n\n");
}