⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mima5.txt

📁 密码程序是一个图形c编的隐形的
💻 TXT
字号:
#include <stdio.h> 
#include <malloc.h> 
#include <stdlib.h> 
#include <string.h> 
main(){ 
FILE *fp; 
int iCount = 0; 
char *cPassWord = NULL,*cTempData = NULL,ch = 0; 
cPassWord = (char *)malloc(100); 
cTempData = (char *)malloc(100); 
if ((fp = fopen("password.bat","r")) == NULL){ 
/*原来没有密码时,初始化密码,保存到文件中*/ 
printf("Please init password!\n"); 
fp = fopen("password.bat","w+"); 
while ((*(cPassWord + iCount) = getch()) != '\r'){ 
printf("*"); 
iCount++; 
} 
*(cPassWord + iCount) = 0; 
printf("\n"); 
fprintf(fp,"%s",cPassWord); 
fclose(fp); 
exit(0); 
} 
fscanf(fp,"%s",cPassWord); 
iCount = 0; 
/*输入密码*/ 
printf("Please input the password:\n"); 
while ((*(cTempData + iCount) = getch()) != '\r'){ 
printf("*"); 
iCount++; 
} 
*(cTempData + iCount) = 0; 
printf("\n"); 
while (1){ 
if (strcmp(cPassWord,cTempData) == 0){/*如果密码正确,退出循环*/ 
printf("Welcome to XXXXXXX"); 
break; 
} 
/*否则重新输入*/ 
system("cls"); 
printf("Password is wrong!\nPlease input the password again:\n"); 
while ((*(cTempData + iCount) = getch()) != '\r'){ 
printf("*"); 
iCount++; 
} 
*(cTempData + iCount) = 0; 
printf("\n"); 
} 
printf("Do you modify the password?(1,YES;2,NO)\n"); 
if((ch = getchar()) == '1'){/*修改密码*/ 
fclose(fp); 
fp = fopen("password.bat","w+"); 
fflush(stdin); 
gets(cPassWord); 
fprintf(fp,"%s",cPassWord); 
} 
fclose(fp); 
free(cPassWord); 
cPassWord = NULL; 
free(cTempData); 
cTempData = NULL; 
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -