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

📄 encrypt.c

📁 本程序为c++环境下实现口令保护功能
💻 C
字号:
#include <stdio.h>
#include <string.h>

void main() 
{ 
	char *password; 
	char kl[9]; 
	int i=0; 
	FILE *fp;
	 
	fp=fopen("KLK.CFG","rb+");
	if(fp!=NULL) 
	{ 
		fseek(fp,0,SEEK_SET); 
		fgets(kl,9,fp); 
		fclose(fp); 
	}
	else
	{
		gotoxy(13,2);
		cputs("No need password!!!");
		getch();
		exit(0);
	}
	
	/* 屏幕背景清屏成蓝色 */ 
	window(1,1,80,25);
	textbackground(1); 
	clrscr(); 
	
	/* 开阴影窗口 */
	window(17,10,58,13);
	textbackground(0); 
	clrscr();
		
	for(i=0;i<=2;i++) 
	{ 
		window(16,9,56,12); 
		textattr(14 | 2<<4); 
		clrscr();
		 
		gotoxy(13,2); 
		password=(char *)getpass("Please input password:"); 
		
		textcolor(4);
		
		if(strcmp(password,kl)!=0)
		{
			gotoxy(13,2); 
			cputs("password error,");
			if(i == 2)	/* 三次口令无效退出 */ 
			{
				cputs("exit!!!"); 
				getch(); 
				exit(0); 
			}
			else		/* 前两次错误,提示重新输入 */
			{
				cputs("Please input again!!!");
				getch();
			}
		} 
		else
			break;
	}
	 
	/* 进入主程序体 */ 
	textbackground(1); 
	window(1,1,80,25); 
	clrscr(); 
	
	gotoxy(10,10); 
	cputs("pass!!!"); 
	getch();
} 

⌨️ 快捷键说明

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