跳到正文

科技·工程

登录系统

tkqt约 94 分钟
原文
文章信息与版本

文章信息

发布
2025年4月11日
收录
2026年3月1日
更新
2026年11月2日
篇幅
约 94 分钟

版本

  1. v2当前
  2. v1

纯属一乐!别当真(找大佬教得)

1 输入(注册)一个账号及其密码。会生成文件(记事本可打开)

2 确定是否还需继续输入(注册)。

3 查询(密码在输入中会打码)。

代码


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*10+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
void clearScreen(){
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0, 0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut,&csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut,coord);
}
int main()
{
	string mima1;
	long long mima2;
	string name;
thji:
	clearScreen();
	cout<<"注册账号!"<<endl;
	cin>>name;
	sd=0;
	ij=0;
	cin>>mima1;
	mima2=hash(mima1);
	chaxun[mima2]=name;
	mima5.push_back(mima1);
	mima3.push_back(mima2);
	int j;
ij:
	clearScreen();
	printf("你还想再写账号吗?想就输入1,不想就输入2\n");
	cin>>j;
	if(j==1) goto thji;
	else if(j!=2) goto ij;
	clearScreen();
	freopen("chaxun.out", "w", stdout);
	for(int i=0;i<mima3.size();i++){
		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
	}
    freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    clearScreen();
    cout<<"已经生成文件!"<<endl;
	Sleep(1000);
ki:
	clearScreen();
	string kl;
	cout<<"查询账号!请输入密码!: ";
	kl=get_hidden_input();
	if(chaxun.find(hash(kl))!=chaxun.end()){
		cout<<chaxun[hash(kl)];
		cout<<"查询成功!"<<endl;
		clearScreen();
	}
	else cout<<"没有!"<<endl;
	Sleep(1000);
	clearScreen();
	printf("你还想查询账号吗?想就输入1,不想就输入2\n");

注:

1 只能在Windows电脑上运行这个程序。

2 有时会出bug(时好时坏)

欢迎反馈及提出修改!

4.14

2.0

第2个版本,修好了所有的bug。

依然只能在Windows点脑上运行。

2.0版本新特性:

1 可以使用在原本生成的文件中查询账号,并支持清空文件。

2 文件为空或清零文件,会产生一个空的错误账号,以免造成误判。


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	printf("你想查询你生成的文件吗?如果想,请输入1.如果想清空文件,请输入2 \n");
	cin>>n;
	if(n==2){
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
	}
	else{
		if(n!=1){
			goto thji;
		}
	}
	freopen("chaxun.out","r",stdin);
	cin>>yuanshi>>mimal;
	freopen("CON","r",stdin);
	cout.clear();
	cout.flush();
	cin.clear();
	if(yuanshi!="noyyy"||mimal!=-1) goto yi;
	else goto thji;
thji:
	printf("注册账号 \n");
	cin>>name;
	sd=0;
	ij=0;
	cin>>mima1;
	mima2=hash(mima1);
	chaxun[mima2]=name;
    mima5.push_back(mima1);
    mima3.push_back(mima2);
ij:
	printf("你还想再写账号吗?想就输入1,不想就输入2\n");
	cin>>j;
	if(j==1) goto thji;
	else if(j!=2) goto ij;
	freopen("chaxun.out", "w", stdout);
	for(int i=0;i<mima3.size();i++){
		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
	}
	cout<<"noyyy"<<" "<<-1<<endl;
    freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    cout<<"已经生成文件!"<<endl;
	Sleep(1000);
	goto ki;
yi:
	cout.flush();
	cout.clear();
	cin.clear();
	mima2=hash(h(mimal));
	chaxun[mima2]=yuanshi;
	mima5.push_back(h(mimal));
	mima3.push_back(mima2);
	cout<<"已有账号!"<<endl;
	goto yj;
ki:
	cout<<"已有账号!"<<endl;
yj:
	string kl;
	cout<<"查询账号!请输入密码!: ";
	kl=get_hidden_input();
	if(chaxun.find(hash(kl))!=chaxun.end()){
		cout<<chaxun[hash(kl)];
		cout<<"查询成功!"<<endl;
		Sleep(1000);
	}
	else{
		cout<<"没有!"<<endl;
		Sleep(1000);
	}
	Sleep(1000);
	printf("你还想查询账号吗?想就输入1,不想就输入2\n");
	cin>>j;
	if(j==1) goto yj;
	cout<<"退出系统!";
	return 0;
}

注:同上一个注。

3.0版本

优化了代码,并删除了再次注册功能(多余)。

应该不会再更新了。


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	printf("你想查询你生成的文件吗?如果想,请输入1.如果想清空文件,请输入2.如果想注册账号,请输入3.\n");
	cin>>n;
	if(n==2){
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
	}
	else{
		if(n==1){
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"查询失败,请从新注册!"<<endl;
	        	cout.clear();
	            cout.flush();
	            cin.clear();
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
			}
         	else{
         		cout.clear();
	            cout.flush();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
            	cout<<"已有账号!"<<endl;
		    }
		}
		else{
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
		}
	}
	while(true){
		string kl;
	    cout<<"查询账号!请输入密码!: ";
	    kl=get_hidden_input();
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"查询成功!"<<endl;
    		Sleep(1000);
    	}
    	else{
    		cout<<"没有!"<<endl;
    		Sleep(1000);
    	}
    	Sleep(1000);
    	printf("你还想查询账号吗?想就输入1,不想就输入2\n");
    	cin>>j;
    	if(j==1) continue;
    	cout<<"退出系统!";
    	break;
	}
	return 0;
}

4.15

打脸!

更新新特点:彩色!


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	printf("你想查询你生成的文件吗?如果想,请输入1.如果想清空文件,请输入2.如果想注册账号,请输入3.\n");
	cin>>n;
	if(n==2){
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
	}
	else{
		if(n==1){
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"查询失败,请从新注册!"<<endl;
	        	cout.clear();
	            cout.flush();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
			}
         	else{
         		cout.clear();
	            cout.flush();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
            	cout<<"已有账号!"<<endl;
		    }
		}
		else{
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"查询账号!请输入密码!: ";
	    kl=get_hidden_input();
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"查询成功!"<<endl;
    		Sleep(1000);
    	}
    	else{
    		cout<<"没有!"<<endl;
    		Sleep(1000);
    	}
    	Sleep(1000);
    	printf("你还想查询账号吗?想就输入1,不想就输入2\n");
    	cin>>j;
    	if(j==1) continue;
    	cout<<"退出系统!";
    	break;
	}
	setColor(FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);
	return 0;
}

4.16

5.0版本

清屏!嗯。。。


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0,0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut, &csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut, coord);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	cout<<"-----登录系统------"<<endl;
	cout<<"1.登录账号"<<endl;
	cout<<"2.注销账号"<<endl;
	cout<<"3.注册账号"<<endl;
	cout<<"请输入指令!"<<endl;
	cin>>n;
	if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
   	    cleanSreen();
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
		cleanSreen();
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	        	cout.clear();
	            cout.flush();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
		       	cleanSreen();
			}
         	else{
         		cout.clear();
	            cout.flush();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
		    }
		}
		else{
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"登录账号!请输入密码!: ";
	    kl=get_hidden_input();
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		break;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    		Sleep(1000);
    		continue;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	return 0;
}

6.0

加入新功能:非登陆完无法关闭窗口与最小化。


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
void no_1(){
	HWND hwnd = GetConsoleWindow();
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style &= ~(WS_MINIMIZEBOX);
    SetWindowLong(hwnd, GWL_STYLE, style);
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
void no_2(){
	HWND hwnd = GetConsoleWindow();
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    AppendMenu(hmenu, MF_STRING, SC_CLOSE, "关闭");
    DrawMenuBar(hwnd);
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style |= WS_MINIMIZEBOX | WS_SYSMENU;
    SetWindowLong(hwnd, GWL_STYLE, style);
    SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0,0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut, &csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut, coord);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	no_1();
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	cout<<"-----登录系统------"<<endl;
	cout<<"1.登录账号"<<endl;
	cout<<"2.注销账号"<<endl;
	cout<<"3.注册账号"<<endl;
	cout<<"请输入指令!"<<endl;
	cin>>n;
	if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
   	    cleanSreen();
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
		cleanSreen();
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	        	cout.clear();
	            cout.flush();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
		       	cleanSreen();
			}
         	else{
         		cout.clear();
	            cout.flush();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
		    }
		}
		else{
			cleanSreen();
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
   	  	    cleanSreen();
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
			cleanSreen();
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"登录账号!请输入密码!: ";
	    kl=get_hidden_input();
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		break;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    		Sleep(1000);
    		continue;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	no_2();
	return 0;
}

6.6版本

加入退出系统

C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
void no_1(){
	HWND hwnd = GetConsoleWindow();
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style &= ~(WS_MINIMIZEBOX);
    SetWindowLong(hwnd, GWL_STYLE, style);
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
void no_2(){
	HWND hwnd = GetConsoleWindow();
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    AppendMenu(hmenu, MF_STRING, SC_CLOSE, "关闭");
    DrawMenuBar(hwnd);
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style |= WS_MINIMIZEBOX | WS_SYSMENU;
    SetWindowLong(hwnd, GWL_STYLE, style);
    SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0,0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut, &csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut, coord);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	no_1();
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	cout<<"-----登录系统------"<<endl;
	cout<<"1.登录账号"<<endl;
	cout<<"2.注销账号"<<endl;
	cout<<"3.注册账号"<<endl;
	cout<<"请输入指令!"<<endl;
	cin>>n;
	if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
   	    cleanSreen();
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
		cleanSreen();
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	        	cout.clear();
	            cout.flush();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
		       	cleanSreen();
			}
         	else{
         		cout.clear();
	            cout.flush();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
		    }
		}
		else{
			cleanSreen();
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
   	  	    cleanSreen();
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
			cleanSreen();
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"(如果你想退出,请输入zhizhe!)登录账号!请输入密码!: ";
	    kl=get_hidden_input();
	    if(kl=="zhizhe") break;
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		continue;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    		Sleep(1000);
    		continue;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	no_2();
	return 0;
}

7.0版本

修好了所有bug


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
void no_1(){
	HWND hwnd = GetConsoleWindow();
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style &= ~(WS_MINIMIZEBOX);
    SetWindowLong(hwnd, GWL_STYLE, style);
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
void no_2(){
	HWND hwnd = GetConsoleWindow();
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    AppendMenu(hmenu, MF_STRING, SC_CLOSE, "关闭");
    DrawMenuBar(hwnd);
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style |= WS_MINIMIZEBOX | WS_SYSMENU;
    SetWindowLong(hwnd, GWL_STYLE, style);
    SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0,0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut, &csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut, coord);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	no_1();
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	cout<<"-----登录系统------"<<endl;
	cout<<"1.登录账号"<<endl;
	cout<<"2.注销账号"<<endl;
	cout<<"3.注册账号"<<endl;
	cout<<"请输入指令!"<<endl;
	cin>>n;
	if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
   	    cleanSreen();
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
		cout.clear();
		cin.clear();
		cleanSreen();
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	        	cout.clear();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
		       	cout.clear();
	        	cin.clear();
		       	cleanSreen();
			}
         	else{
         		cout.clear();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
		    }
		}
		else{
			cleanSreen();
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
   	  	    cleanSreen();
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
			cout.clear();
		    cin.clear();
			cleanSreen();
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"(如果你想退出,请输入zhizhe!)登录账号!请输入密码!: ";
	    kl=get_hidden_input();
	    if(kl=="zhizhe") break;
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		continue;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    		Sleep(1000);
    		cleanSreen();
    		continue;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	no_2();
	return 0;
}

7.111

取消bug修复,应为bug更多了。


C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
void no_1(){
	HWND hwnd = GetConsoleWindow();
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style &= ~(WS_MINIMIZEBOX);
    SetWindowLong(hwnd, GWL_STYLE, style);
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
void no_2(){
	HWND hwnd = GetConsoleWindow();
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    AppendMenu(hmenu, MF_STRING, SC_CLOSE, "关闭");
    DrawMenuBar(hwnd);
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style |= WS_MINIMIZEBOX | WS_SYSMENU;
    SetWindowLong(hwnd, GWL_STYLE, style);
    SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord={0,0};
    DWORD count;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    GetConsoleScreenBufferInfo(hStdOut, &csbi);
    FillConsoleOutputCharacter(hStdOut,' ',csbi.dwSize.X*csbi.dwSize.Y,coord,&count);
    SetConsoleCursorPosition(hStdOut, coord);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	no_1();
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	cout<<"-----登录系统------"<<endl;
	cout<<"1.登录账号"<<endl;
	cout<<"2.注销账号"<<endl;
	cout<<"3.注册账号"<<endl;
	cout<<"请输入指令!"<<endl;
	cin>>n;
	if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请重新注册账号!"<<endl;
		Sleep(1000);
		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
		printf("注册账号 \n");
    	cin>>name;
		sd=0;
		ij=0;
		cin>>mima1;
		mima2=hash(mima1);
		chaxun[mima2]=name;
    	mima5.push_back(mima1);
   	    mima3.push_back(mima2);
   	    cleanSreen();
		freopen("chaxun.out", "w", stdout);
		for(int i=0;i<mima3.size();i++){
			cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		}
		cout<<"noyyy"<<" "<<-1<<endl;
    	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	cout<<"已经生成文件!"<<endl;
		Sleep(1000);
		cout.clear();
		cin.clear();
		cleanSreen();
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	        	cout.clear();
	            cin.clear();
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	        	printf("注册账号 \n");
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    	       	cout<<"已经生成文件!"<<endl;
		       	Sleep(1000);
		       	cout.clear();
	        	cin.clear();
		       	cleanSreen();
			}
         	else{
         		cout.clear();
	            cin.clear();
        	    mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
		    }
		}
		else{
			cleanSreen();
			setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
			printf("注册账号 \n");
    		cin>>name;
			sd=0;
			ij=0;
			cin>>mima1;
			mima2=hash(mima1);
			chaxun[mima2]=name;
    		mima5.push_back(mima1);
   	  	    mima3.push_back(mima2);
   	  	    cleanSreen();
			freopen("chaxun.out", "w", stdout);
			for(int i=0;i<mima3.size();i++){
				cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
			}
			cout<<"noyyy"<<" "<<-1<<endl;
    		freopen("CON", "w", stdout);//关闭文件输入输出(windows)
    		cout<<"已经生成文件!"<<endl;
			Sleep(1000);
			cout.clear();
		    cin.clear();
			cleanSreen();
		}
	}
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
	    cout<<"(如果你想退出,请输入zhizhe!)登录账号!请输入密码!: ";
	    kl=get_hidden_input();
	    if(kl=="zhizhe") break;
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		break;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	no_2();
	return 0;
}

8.0

不更新了!最后一更!

C++
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include<string>
#include<conio.h>
#include<windows.h>
#define mod 10000007
using namespace std;
map <long long,string> chaxun;
vector <long long> mima3;
vector <string> mima5;
void no_1(){
	HWND hwnd = GetConsoleWindow();
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style &= ~(WS_MINIMIZEBOX);
    SetWindowLong(hwnd, GWL_STYLE, style);
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
    SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
void no_2(){
	HWND hwnd = GetConsoleWindow();
    HMENU hmenu = GetSystemMenu(hwnd, FALSE);
    AppendMenu(hmenu, MF_STRING, SC_CLOSE, "关闭");
    DrawMenuBar(hwnd);
    LONG style = GetWindowLong(hwnd, GWL_STYLE);
    style |= WS_MINIMIZEBOX | WS_SYSMENU;
    SetWindowLong(hwnd, GWL_STYLE, style);
    SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
string get_hidden_input() {
    string input;
    char ch;
    while((ch=_getch())!='\r') {
        if(ch=='\b'){
            if(!input.empty()){
                input.erase(input.size()-1);
            }
        } else{
              input.push_back(ch);
              cout <<'*';
            }
    }
    cout<<endl;
    return input;
}
void setColor(WORD color){
    HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,color);
}
void cleanSreen() {
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    COORD coord = {0, 0};
    if (GetConsoleScreenBufferInfo(hStdOut, &csbi)) {
        DWORD count;
        DWORD bufferSize = csbi.dwSize.X * csbi.dwSize.Y;
        FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
        FillConsoleOutputCharacter(hStdOut, ' ', bufferSize, coord, &count);
        FillConsoleOutputAttribute(hStdOut, csbi.wAttributes, bufferSize, coord, &count);
        SetConsoleCursorPosition(hStdOut, coord);
    }
    Sleep(100);
}
long long hash(string n){
	int hash=1;
	for(int i=0;n[i];i++){
		hash=(hash*187+n[i])%mod;
	}
	return hash;
}
int ij=0;
long long sd=0;
long long z(string n){
	ij=n.size()-1;
	sd=0;
	while(ij<n.size()){
		int j=n[ij]-'0';
	    for(int i=1;i<=ij;i++){
		    j*=10;
	    }
	    sd+=j;
	    ij--;
	}
	return sd;
}
string h(long long n){
	string sd="";
	string sd2;
	while(n>0){
		char gh=(char)(n%10)+'0';
		sd2+=gh;
		n/=10;
	}
	for(int i=sd2.size()-1;i>=0;i--){
		sd+=sd2[i];
	}
	return sd;
}
int j;
int main()
{
	no_1();
	int n;
	string yuanshi;
	int mimal;
	string mima1;
	long long mima2;
	string name;
	setColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	while(true){
		cout<<"-----登录系统------"<<endl;
    	cout<<"1.登录账号"<<endl;
    	cout<<"2.注销账号"<<endl;
    	cout<<"3.注册账号"<<endl;
    	cout<<"请输入指令!"<<endl;
		cin>>n;
		if(n==2){
		cleanSreen();
		freopen("chaxun.out","w",stdout);
		cout<<"gg"<<" "<<-33<<endl;
		cout<<"noyyy"<<" "<<-1<<endl;
		freopen("CON","w",stdout);
		cout.clear();
		cin.clear();
		cout<<"已经清空完成!请关闭运行台从新注册!"<<endl;
		return 0;
	}
	else{
		if(n==1){
			cleanSreen();
			freopen("chaxun.out","r",stdin);
	        cin>>yuanshi>>mimal;
	        freopen("CON","r",stdin);
	        fflush(stdin);
            fflush(stdout);
            cout.clear();
	        cin.clear();
	        if(yuanshi=="noyyy"||mimal==-1){
	        	cout<<"没有账号!"<<endl;
	        	cout<<"登录失败,请从新注册!"<<endl;
	            setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
	            cleanSreen();
	        	cout<<"注册账号"<<endl;
    	        cin>>name;
			    sd=0;
			    ij=0;
			    cin>>mima1;
		       	mima2=hash(mima1);
		       	chaxun[mima2]=name;
    	       	mima5.push_back(mima1);
   	  	        mima3.push_back(mima2);
   	  	        cleanSreen();
		       	freopen("chaxun.out", "w", stdout);
		       	for(int i=0;i<mima3.size();i++){
		       		cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
		       	}
		       	cout<<"noyyy"<<" "<<-1<<endl;
    	       	freopen("CON", "w", stdout);//关闭文件输入输出(windows)
		       	Sleep(1000);
		       	cout.clear();
	        	cin.clear();
		       	cleanSreen();cout.clear();
	            cin.clear();
		       	break;
			}
         	else{
         		if(yuanshi=="gg"&&mimal==-33){
         		setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
         		cout<<"你账号已被注销!!"<<endl;
         		Sleep(1000);
         		cleanSreen();
         		cout<<"注册账号!"<<endl;
    			cin>>name;
				sd=0;
				ij=0;
				cin>>mima1;
				mima2=hash(mima1);
				chaxun[mima2]=name;
    			mima5.push_back(mima1);
   	  	 	    mima3.push_back(mima2);
   	  	  	    cleanSreen();
				freopen("chaxun.out", "w", stdout);
				for(int i=0;i<mima3.size();i++){
					cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
				}
				cout<<"noyyy"<<" "<<-1<<endl;
    			freopen("CON", "w", stdout);//关闭文件输入输出(windows)
				Sleep(1000);
				cout.clear();
			    cin.clear();
			    cleanSreen();
			    break;
				 }
				 else{
				 	mima2=hash(h(mimal));
        	    chaxun[mima2]=yuanshi;
        	    mima5.push_back(h(mimal));
            	mima3.push_back(mima2);
            	break;
				 }
		    }
		}
		else{
			if(n==3){
				cleanSreen();
			    setColor(FOREGROUND_RED|FOREGROUND_INTENSITY);
				cout<<"注册账号!"<<endl;
    			cin>>name;
				sd=0;
				ij=0;
				cin>>mima1;
				mima2=hash(mima1);
				chaxun[mima2]=name;
    			mima5.push_back(mima1);
   	  	 	    mima3.push_back(mima2);
   	  	  	    cleanSreen();
				freopen("chaxun.out", "w", stdout);
				for(int i=0;i<mima3.size();i++){
					cout<<chaxun[mima3[i]]<<" "<<mima5[i]<<endl;
				}
				cout<<"noyyy"<<" "<<-1<<endl;
    			freopen("CON", "w", stdout);//关闭文件输入输出(windows)
				Sleep(1000);
				cout.clear();
			    cin.clear();
			    cleanSreen();
			    break;
			}
			else{
				cout<<"Wrong wrong!"<<endl;
			    Sleep(1000);
			    cleanSreen();
				continue;
			}
		}
	}
	}
	cleanSreen();
	Sleep(1000);
	while(true){
		string kl;
		setColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
		Sleep(1000);
	    cout<<"(如果你想退出,请输入zhizhe!)登录账号!请输入密码!: ";
	    kl=get_hidden_input();
	    if(kl=="zhizhe") break;
    	if(chaxun.find(hash(kl))!=chaxun.end()){
    		cout<<chaxun[hash(kl)];
    		cout<<"登录成功!"<<endl;
    		Sleep(1000);
    		break;
    	}
    	else{
    		cout<<"登录失败!Wrong key!"<<endl;
    		Sleep(1000);
    		cleanSreen();
    		continue;
    	}
	}
	setColor(FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"退出系统!";
	Sleep(222);
	no_2();
	return 0;
}
原文
抓取于
  1. tkqt

    下次更新吗。。。呵呵