专栏文章

another_game 代码

休闲·娱乐参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@mioka3bt
此快照首次捕获于
2025/12/02 20:35
3 个月前
此快照最后确认于
2025/12/02 20:35
3 个月前
查看原文
CPP
#include <bits/stdc++.h>
#include <windows.h>
#include <winternl.h>
#include <conio.h>
#include <time.h>
using namespace std;
int userlen;
long long fps_round;
int fps_fps=0,fps_oldfps[1050],fps_oldfpspos,fps_fpssum,fps_oldfpslen=100,fps_realfps;
string username[150],password[150],adminpassword="Blank.admin.password";
string userdata[10050];
int usernow;
//basic tool function area start
void puttostr(int x,string &str)
{
	if(x<0)
	{
		str+='-';
		puttostr(-x,str);
	}
	if(x>9)
	{
		puttostr(x/10,str);
	}
	str+=(x%10)+'0';
}
void save_root()
{
	fclose(stdout);
	freopen("another_game.data","w",stdout);
	cout<<adminpassword<<endl;
	cout<<userlen<<endl;
	for(int i=1;i<=userlen;i++)
	{
		cout<<username[i]<<" "<<password[i]<<endl;
	}
	cout<<endl;
	fclose(stdout);
	freopen("CON","w",stdout);
}
void save_user()
{
	fclose(stdout);
	char file_path[100]="another_game_user_";
	int len=username[usernow].length();
	for(int i=0;i<len;i++)
	{
		file_path[18+i]=username[usernow][i];
	}
	file_path[18+len]='.';
	file_path[19+len]='d';
	file_path[20+len]='a';
	file_path[21+len]='t';
	file_path[22+len]='a';
	file_path[23+len]='\0';
	freopen(file_path,"w",stdout);
	for(int i=1;i<=10000;i++)
	{
		if(userdata[i]!="")
		{
			cout<<i<<endl;
			cout<<userdata[i]<<endl;
			cout<<endl;
		}
	}
	cout<<-1<<endl;
	fclose(stdout);
	freopen("CON","w",stdout);
}
bool getsaving_root()
{
	freopen("another_game.data","r",stdin);
	cin>>adminpassword;
	if(adminpassword=="Blank.admin.password")
	{
		return 0;
	}
	cin>>userlen;
	for(int i=1;i<=userlen;i++)
	{
		cin>>username[i]>>password[i];
	}
	fclose(stdin);
	return 1;
}
void getsaving_user()
{
	char file_path[100]="another_game_user_";
	int len=username[usernow].length();
	for(int i=0;i<len;i++)
	{
		file_path[18+i]=username[usernow][i];
	}
	file_path[18+len]='.';
	file_path[19+len]='d';
	file_path[20+len]='a';
	file_path[21+len]='t';
	file_path[22+len]='a';
	file_path[23+len]='\0';
	freopen(file_path,"r",stdin);
	while(1)
	{
		int id;
		cin>>id;
		if(id==-1)
		{
			break;
		}
		cin>>userdata[id];
	}
	return;
}
POINT pointerpos()
{
    POINT pt;
    GetCursorPos(&pt);
    HWND h=GetForegroundWindow();
    ScreenToClient(h,&pt);
    pt.x/=8;pt.y/=16;
    int t=pt.x;
    pt.x=pt.y;
    pt.y=t;
    return pt;
}
int pointerx()
{
	return pointerpos().x;
}
int pointery()
{
	return pointerpos().y;
}
int getcolor(string str)
{
	if(str=="dark black")
	{
		return 0;
	}
	else if(str=="dark blue")
	{
		return 1;
	}
	else if(str=="dark green")
	{
		return 2;
	}
	else if(str=="dark cyan")
	{
		return 3;
	}
	else if(str=="dark red")
	{
		return 4;
	}
	else if(str=="dark purple")
	{
		return 5;
	}
	else if(str=="dark yellow")
	{
		return 6;
	}
	else if(str=="dark white")
	{
		return 7;
	}
	else if(str=="light black")
	{
		return 8;
	}
	else if(str=="light blue")
	{
		return 9;
	}
	else if(str=="light green")
	{
		return 10;
	}
	else if(str=="light cyan")
	{
		return 11;
	}
	else if(str=="light red")
	{
		return 12;
	}
	else if(str=="light purple")
	{
		return 13;
	}
	else if(str=="light yellow")
	{
		return 14;
	}
	else if(str=="light white")
	{
		return 15;
	}
	else
	{
		return 0;
	}
}
void setcolor(string str2="light white",string str1="dark black")
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),getcolor(str1)*16+getcolor(str2));
}
void setcolor(int int2=15,int int1=0)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),int1*16+int2);
}
void hidecursor()
{
	CONSOLE_CURSOR_INFO cursor_info={1,0}; //第二个值0表示隐藏光标
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void showcursor()
{
	CONSOLE_CURSOR_INFO cursor_info={1,1}; //第二个值0表示隐藏光标
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
} 
void setpos(int i, int j) { //设置坐标点位(光标)
	HANDLE hout;
	COORD coord;
	coord.X = j;
	coord.Y = i;
	hout = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hout, coord);
}
void putline(int x,int y,char ch,int times)
{
	setpos(x,y);
	for(int i=1;i<=times;i++)
	{
		cout<<ch;
	}
}
void printline(int r,int c,char ch,int num)
{
	setpos(r,c);
	for(int i=1;i<=num;i++)
	{
		cout<<ch;
	}
}
bool launch()
{
	setcolor("light white");
	cout<<"Please wait while game is loading..."<<endl;
	cout<<"Hint: this message should appear when you compile the program"<<endl;
	cout<<"Hint: use arrow keys"<<endl;
	cout<<"Hint: do not use VScode"<<endl;
	cout<<"Hint: if this text lasts more than 1 minutes, your saves might be damaged."<<endl;
	cout<<"Hint: if your save was damaged, you can delete another_game.data to restart everything."<<endl;
	hidecursor();
	if(!getsaving_root())//no 'another_game.data'
	{
		fclose(stdin);
		system("cls");
		cout<<"This is the first time you launch the game.You need to set the admin password.(You cannot change it after this time)"<<endl;
		cout<<">>> Admin password: "<<endl;
		cout<<"    Comfirm admin password: "<<endl;
		cout<<"    Done!";
		char adminpw1[150],adminpw2[150];
		int adminpw1len=0,adminpw2len=0;
		int cursorposition=1;
		while(1)
		{
			if(kbhit())
			{
				int ch1,ch2=-1;
				ch1=getch();
				if(ch1/128)
				{
					ch2=getch();
				}
				if(ch1==224 && ch2==80)
				{
					if(cursorposition>=3)
					{
						continue;
					}
					setpos(cursorposition,0);
					cout<<"   ";
					cursorposition++;
					setpos(cursorposition,0);
					cout<<">>>";
				}
				else if(ch1==224 && ch2==72)
				{
					if(cursorposition<=1)
					{
						continue;
					}
					setpos(cursorposition,0);
					cout<<"   ";
					cursorposition--;
					setpos(cursorposition,0);
					cout<<">>>";
				}
				else if(ch2==-1 && ((ch1>='A' && ch1<='Z') || (ch1>='a' && ch1<='z') || (ch1>='0' && ch1<='9') || ch1==' ' || ch1=='_'))
				{
					if(ch1==' ')
					{
						ch1='_';
					}
					if(cursorposition==1)
					{
						setpos(cursorposition,20+adminpw1len);
						cout<<(char)ch1;
						adminpw1len++;
						adminpw1[adminpw1len]=ch1;
					}
					if(cursorposition==2)
					{
						setpos(cursorposition,28+adminpw2len);
						cout<<(char)ch1;
						adminpw2len++;
						adminpw2[adminpw2len]=ch1;
					}
				}
				else if(ch1==8 && ch2==-1)
				{
					if(cursorposition==1)
					{
						if(adminpw1len<=0)
						{
							continue;
						}
						setpos(cursorposition,20+adminpw1len-1);
						cout<<" ";
						adminpw1[adminpw1len]=' ';
						adminpw1len--;
					}
					if(cursorposition==2)
					{
						if(adminpw2len<=0)
						{
							continue;
						}
						setpos(cursorposition,28+adminpw2len-1);
						cout<<" ";
						adminpw2[adminpw2len]=' ';
						adminpw2len--;
					}
				}
				else if(ch1==224 && ch2==77)
				{
					if(cursorposition==3)
					{
						if(adminpw1len!=adminpw2len)
						{
							setpos(4,0);
							setcolor("light red");
							cout<<"Admin password is not equal to comfirm password!                                ";
							setcolor("light white");
							continue;
						}
						bool good=1;
						for(int i=1;i<=adminpw1len;i++)
						{
							if(adminpw1[i]!=adminpw2[i])
							{
								setpos(4,0);
								setcolor("light red");
								cout<<"Admin password is not equal to comfirm password!                                ";
								setcolor("light white");
								good=0;
								break;
							}
						}
						if(good==0)
						{
							continue;
						}
						setpos(4,0);
						if(adminpw1len==0)
						{
							setpos(4,0);
							setcolor("light red");
							cout<<"Admin password too short!                                                       ";
							setcolor("light white");
							continue;
						}
						adminpassword="";
						for(int i=1;i<=adminpw1len;i++)
						{
							adminpassword+=adminpw1[i];
						}
						save_root();
						setcolor("light green");
						cout<<"Done! (Restart this program to proceed.)                                        "<<endl;
						setcolor("light white");
						return 0;
					}
				}
			}
			Sleep(10);
		}
	}
	system("cls");
	cout<<"Login or Register?"<<endl;
	cout<<">>> Login"<<endl;
	cout<<"    Register"<<endl;
	int cursorposition=1;
	hidecursor();
	while(1)
	{
		if(_kbhit())
		{
			int input1=getch(),input2=-1;
			if(input1/128)
			{
				input2=getch();
			}
			if(input1==224 && input2==80)
			{
				if(cursorposition<2)
				{
					setpos(cursorposition,0);
					cout<<"   ";
					cursorposition++;
					setpos(cursorposition,0);
					cout<<">>>";
				}
			}
			else if(input1==224 && input2==72)
			{
				if(cursorposition>1)
				{
					setpos(cursorposition,0);
					cout<<"   ";
					cursorposition--;
					setpos(cursorposition,0);
					cout<<">>>";
				}
			}
			else if(input1==224 && input2==77)
			{
				if(cursorposition==1)
				{
					system("cls");
					setpos(0,0);
					cout<<"Login:"<<endl;
					cout<<">>> Username: "<<endl;
					cout<<"    Password: "<<endl;
					cout<<"    Login!"<<endl;
					cout<<"    Quit";
					cursorposition=1;
					int usernamelen=0,passwordlen=0;
					int loginchance=5;
					char usernamenow[150]={0},passwordnow[150]={0};
					while(1)
					{
						if(_kbhit())
						{
							int input1=getch(),input2=-1;
							if(input1/128)
							{
								input2=getch();
							}
							if(input1==224 && input2==80)//down
							{
								if(cursorposition<4)
								{
									setpos(cursorposition,0);
									cout<<"   ";
									cursorposition++;
									setpos(cursorposition,0);
									cout<<">>>";
								}
							}
							else if(input1==224 && input2==72)//up
							{
								if(cursorposition>1)
								{
									setpos(cursorposition,0);
									cout<<"   ";
									cursorposition--;
									setpos(cursorposition,0);
									cout<<">>>";
								}
							}
							else if(input2==-1 && ((input1>='A' && input1<'Z') || (input1>='a' && input1<='z') || (input1>='0' && input1<='9') || input1==' ' || input1=='_'))//input
							{
								if(input1==' ')
								{
									input1='_';
								}
								if(cursorposition==1)
								{
									setpos(cursorposition,14+usernamelen);
									cout<<(char)input1;
									usernamenow[usernamelen]=input1;
									usernamelen++;
								}
								else if(cursorposition==2)
								{
									setpos(cursorposition,14+passwordlen);
									cout<<(char)input1;
									passwordnow[passwordlen]=input1;
									passwordlen++;
								}
							}
							else if(input1==8 && input2==-1)//backspace
							{
								if(cursorposition==1)
								{
									if(usernamelen==0)
									{
										continue;
									}
									usernamelen--;
									setpos(cursorposition,14+usernamelen);
									cout<<" ";
									usernamenow[usernamelen]=0;
								}
								else if(cursorposition==2)
								{
									if(passwordlen==0)
									{
										continue;
									}
									passwordlen--;
									setpos(cursorposition,14+passwordlen);
									cout<<" ";
									passwordnow[passwordlen]=0;
								}
							}
							else if(input1==224 && input2==77)// Right
							{
								if(cursorposition==3)
								{
									setpos(5,0);
									int findindex=-1;
									for(int i=1;i<=userlen;i++)
									{
								    	int good=1;
										int len1=username[i].length(),len2=password[i].length();
										if(len1==usernamelen && len2==passwordlen)
										{
											for(int j=0;j<len1;j++)
											{
												if(username[i][j]!=usernamenow[j])
												{
													good=0;
													break;
												}
											}
//											if(good==0)
//											{
//												break;
//											}
											for(int j=0;j<len2;j++)
											{
												if(password[i][j]!=passwordnow[j])
												{
													good=0;
													break;
												}
											}
										}
										else
										{
											good=0;
										}
										if(good)
										{
											findindex=i;
											break;
										}
									}
//									setpos(5,0);
//									setcolor("light white");
//									cout<<findindex<<endl;
									if(findindex!=-1)
									{
										usernow=findindex;
										setcolor("light green");
										cout<<"You have succefully logged!                                                     "<<endl;
										setcolor("light white");
										return 1;
									}
									else
									{
										setcolor("light red");
										cout<<"Wrong username or password!"<<endl;
										loginchance--;
										cout<<"You can try "<<loginchance<<" more times.                                                       ";
										if(loginchance==0)
										{
											system("cls");
											cout<<"Login failed!"<<endl<<"You enter the wrong username or password for too many times.";
					                        setcolor("light white");
											return 0;
										}
										setcolor("light white");
									}
								}
								else if(cursorposition==4)
								{
									cursorposition=1;
									system("cls");
									cout<<"Login or Register?"<<endl;
									cout<<">>> Login"<<endl;
									cout<<"    Register"<<endl;
									break;
								}
							}
						}
						Sleep(10);
					}
				}
				else if(cursorposition==2)
				{
					system("cls");
					setpos(0,0);
					cout<<"Register:"<<endl;
					cout<<">>> Admin password: "<<endl;
					cout<<"    Username: "<<endl;
					cout<<"    Password: "<<endl;
					cout<<"    Confirm password: "<<endl;
					cout<<"    Register!"<<endl;
					cout<<"    Quit";
					cursorposition=1;
					int usernamelen=0,passwordlen=0,adminpasswordlen=0,comfirmpasswordlen=0;
					int loginchance=5;
					char usernamenow[150]={0},passwordnow[150]={0},adminpasswordnow[150]={0},comfirmpasswordnow[150]={0};
					while(1)
					{
						if(_kbhit())
						{
							int input1=getch(),input2=-1;
							if(input1/128)
							{
								input2=getch();
							}
							if(input1==224 && input2==80)//down
							{
								if(cursorposition<6)
								{
									setpos(cursorposition,0);
									cout<<"   ";
									cursorposition++;
									setpos(cursorposition,0);
									cout<<">>>";
								}
							}
							else if(input1==224 && input2==72)//up
							{
								if(cursorposition>1)
								{
									setpos(cursorposition,0);
									cout<<"   ";
									cursorposition--;
									setpos(cursorposition,0);
									cout<<">>>";
								}
							}
							else if(input2==-1 && ((input1>='A' && input1<='Z') || (input1>='a' && input1<='z') || (input1>='0' && input1<='9') || input1==' ' || input1=='_'))//input
							{
								if(input1==' ')
								{
									input1='_';
								}
								if(cursorposition==1)
								{
									setpos(cursorposition,20+adminpasswordlen);
									cout<<(char)input1;
									adminpasswordnow[adminpasswordlen]=input1;
									adminpasswordlen++;
								}
								else if(cursorposition==2)
								{
									setpos(cursorposition,14+usernamelen);
									cout<<(char)input1;
									usernamenow[usernamelen]=input1;
									usernamelen++;
								}
								else if(cursorposition==3)
								{
									setpos(cursorposition,14+passwordlen);
									cout<<(char)input1;
									passwordnow[passwordlen]=input1;
									passwordlen++;
								}
								else if(cursorposition==4)
								{
									setpos(cursorposition,22+comfirmpasswordlen);
									cout<<(char)input1;
									comfirmpasswordnow[comfirmpasswordlen]=input1;
									comfirmpasswordlen++;
								}
							}
							else if(input1==8)//backspace
							{
								if(cursorposition==1)
								{
									if(adminpasswordlen==0)
									{
										continue;
									}
									adminpasswordlen--;
									setpos(cursorposition,20+adminpasswordlen);
									cout<<" ";
									adminpasswordnow[adminpasswordlen]=0;
								}
								else if(cursorposition==2)
								{
									if(usernamelen==0)
									{
										continue;
									}
									usernamelen--;
									setpos(cursorposition,14+usernamelen);
									cout<<" ";
									usernamenow[usernamelen]=0;
								}
								else if(cursorposition==3)
								{
									if(passwordlen==0)
									{
										continue;
									}
									passwordlen--;
									setpos(cursorposition,14+passwordlen);
									cout<<" ";
									passwordnow[passwordlen]=0;
								}
								else if(cursorposition==4)
								{
									if(comfirmpasswordlen==0)
									{
										continue;
									}
									comfirmpasswordlen--;
									setpos(cursorposition,22+comfirmpasswordlen);
									cout<<" ";
									comfirmpasswordnow[comfirmpasswordlen]=0;
								}
							}
							else if(input1==224 && input2==77)//right
							{
								if(cursorposition==5)
								{
									setpos(7,0);
									int len1=adminpassword.length();
									if(len1!=adminpasswordlen)
									{
										setcolor("light red");
										cout<<"Wrong admin password!                                              "<<endl;
										loginchance--;
										cout<<"You can try "<<loginchance<<" more times.                          "<<endl;
										if(loginchance==0)
										{
											system("cls");
											cout<<"Register failed!"<<endl;
											cout<<"You enter the worng adminpassword for too many times."<<endl;
											setcolor("light white");
											return 0;
										}
										setcolor("light white");
										continue;
									}
									bool good0=1;
									for(int i=0;i<len1;i++)
									{
										if(adminpassword[i]!=adminpasswordnow[i])
										{
											good0=0;
											break;
										}
									}
									if(!good0)
									{
										setcolor("light red");
										cout<<"Wrong admin password!                                              "<<endl;
										loginchance--;
										cout<<"You can try "<<loginchance<<" more times.                          "<<endl;
										if(loginchance==0)
										{
											system("cls");
											cout<<"Register failed!"<<endl;
											cout<<"You enter the worng adminpassword for too many times."<<endl;
											setcolor("light white");
											return 0;
										}
										setcolor("light white");
										continue;
									}
									
									int findindex=-1;
									for(int i=1;i<=userlen;i++)
									{
								    	int good=1;
										int len1=username[i].length();
										if(len1==usernamelen)
										{
											for(int j=0;j<len1;j++)
											{
												if(username[i][j]!=usernamenow[j])
												{
													good=0;
													break;
												}
											}
											if(good==0)
											{
												break;
											}
										}
										else
										{
											good=0;
										}
										if(good)
										{
											findindex=i;
											break;
										}
									}
									setpos(7,0);
									if(findindex!=-1)
									{
										setcolor("light red");
										cout<<"You have already registered!"<<endl<<"                                                       ";
										cout<<"                                                                                             "<<endl;
										setcolor("light white");
										continue;
									}
									if(passwordlen!=comfirmpasswordlen)
									{
										setcolor("light red");
										cout<<"Password is not equal to comfirm password!                                                   "<<endl;
										cout<<"                                                                                             "<<endl;
										setcolor("light white");
										continue;
									}
									bool good=1;
									for(int i=1;i<=passwordlen;i++)
									{
										if(passwordnow[i]!=comfirmpasswordnow[i])
										{
											setcolor("light red");
											cout<<"Password is not equal to comfirm password!                                                   "<<endl;
											cout<<"                                                                                             "<<endl;
									    	setcolor("light white");
									    	good=0;
										    break;
										}
									}
									if(!good)
									{
										continue;
									}
									if(usernamelen==0)
									{
										setcolor("light red");
										cout<<"Username too short!                                                                          "<<endl;
										cout<<"                                                                                             "<<endl;
										setcolor("light white");
										continue;
									}
									if(passwordlen==0)
									{
										setcolor("light red");
										cout<<"Password too short!"<<endl;
										setcolor("light white");
										continue;
									}
									userlen++;
									for(int i=0;i<usernamelen;i++)
									{
										username[userlen]+=usernamenow[i];
									}
									for(int i=0;i<passwordlen;i++)
									{
										password[userlen]+=passwordnow[i];
									}
									save_root();
									usernow=userlen;
									save_user();
									setcolor("light green");
									cout<<"You have succefully registered!                               "<<endl;
									cout<<"You need to restart this program.                             "<<endl;
									setcolor("light white");
									return 0;
								}
								else if(cursorposition==6)
								{
									system("cls");
									cout<<"Login or Register?"<<endl;
									cout<<"    Login"<<endl;
									cout<<">>> Register"<<endl;
									cursorposition=2;
									break;
								}
							}
						}
						Sleep(10);
					}
				}
			}
		}
		Sleep(10);
	}
	
	return 0;
}
void notes()
{
	/*
	there are 16 colors:
	0=dark black
	1=dark blue;
	2=dark green
	3=dark cyan
	4=dark red
	5=dark purple
	6=dark yellow
	7=dark white
	8=light black
	9=light blue
	10=light green
	11=light cyan
	12=light red
	13=light purple
	14=light yellow
	15=light white
	16*bgcolor+1*frontcolor
	
	
	up:224 72
    down:224 80
    left:224 75
    right:224 77
    
	width=120,height=30 
	*/
}
//basic tool function area end
//games area start
//game 1
void game_the_max_sum()
{
	system("cls");
	setpos(0,0);
	cout<<"The max sum"<<endl;
	cout<<">>> Start"<<endl;
	cout<<"    Rules"<<endl;
	cout<<"    Settings"<<endl;
	cout<<"    Stats"<<endl;
	cout<<"    Quit"<<endl;
	srand(time(0));
	int dicemin=1,dicemax=1,multi1=1,multi2=1,tries=1,diescore=100,highscore=0;
	if(userdata[1]=="")
	{
		dicemin=1;
		dicemax=6;
		multi1=1;
		multi2=10;
		tries=10;
		diescore=100;
		highscore=0;
		cout<<"This is first time you play the game."<<endl;
		cout<<"Read the rules."<<endl;
	}
	else
	{
		int pt=0;
		dicemin=dicemax=multi1=multi2=tries=diescore=highscore=0;
		while(userdata[1][pt]!=',')
		{
			dicemin*=10;
			dicemin+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			dicemax*=10;
			dicemax+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			multi1*=10;
			multi1+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			multi2*=10;
			multi2+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			tries*=10;
			tries+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			diescore*=10;
			diescore+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
		while(userdata[1][pt]!=',')
		{
			highscore*=10;
			highscore+=userdata[1][pt]-'0';
			pt++;
		}
		pt++;
	}
	int cursorpos1=1;
	while(1)
	{
		if(kbhit())
		{
			int ch1=getch(),ch2=-1;
			if(ch1/128)
			{
				ch2=getch();
			}
			if(ch1==224 && ch2==72 && cursorpos1>1)
			{
				setpos(cursorpos1,0);
				cout<<"   ";
				cursorpos1--;
				setpos(cursorpos1,0);
				cout<<">>>";
			}
			else if(ch1==224 && ch2==80 && cursorpos1<5)
			{
				setpos(cursorpos1,0);
				cout<<"   ";
				cursorpos1++;
				setpos(cursorpos1,0);
				cout<<">>>";
			}
			else if(ch1==224 && ch2==77)
			{
				if(cursorpos1==1)//start
				{
					system("cls");
					setpos(0,0);
					int score=0;
					for(int i=1;i<=10;i++)
					{
						int dice=rand()%6+1;
						cout<<"Round "<<i<<"/"<<10<<endl;
						cout<<"Score: "<<score<<endl;
						cout<<"Dice is "<<dice<<endl;
						cout<<"Wanna x10 or x1? (1/0)"<<endl;
						cout<<endl;
						int input=-1;
						while(1)
						{
							if(kbhit())
							{
								int ch1=getch(),ch2=-1;
								if(ch1/128)
								{
									ch2=getch();
								}
								if(ch1==48 && ch2==-1)
								{
									input=0;
									break;
								}
								else if(ch1==49 && ch2==-1)
								{
									input=1;
									break;
								}
							}
						}
						if(input==0)
						{
							score+=dice;
						}
						else
						{
							score+=dice*10;
						}
						if(score>100)
						{
							break;
						}
					}
					if(score<=100)
					{
						cout<<"You win!!!"<<endl;
						cout<<"Your score is "<<score<<"!"<<endl;
						cout<<"Your highest score is "<<highscore<<"."<<endl;
						if(score>highscore)
						{
							cout<<"Highscore updated to "<<score<<endl;
							highscore=score;
							cout<<"Congradulations!"<<endl;
						}
						else
						{
							cout<<"Keep trying!"<<endl;
						}
					}
					else
					{
						cout<<"You died because your score is too high!"<<endl;
						cout<<"Your score is "<<score<<endl;
						cout<<"Your highest score is "<<highscore<<"."<<endl;
						cout<<"You lose!!!"<<endl;
					}
					cout<<"Press space to continue..."<<endl;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==32 && ch2==-1)
							{
								break;
							}
						}
					}
					system("cls");
					setpos(0,0);
					cout<<"The max sum"<<endl;
					cout<<">>> Start"<<endl;
					cout<<"    Rules"<<endl;
					cout<<"    Settings"<<endl;
					cout<<"    Stats"<<endl;
					cout<<"    Quit"<<endl;
				}
				if(cursorpos1==2)//rules
				{
					system("cls");
					setpos(0,0);
					cout<<"The max sum rules"<<endl;
					cout<<"There are "<<tries<<" dice rolls."<<endl;
					cout<<"Each will generate random number from "<<dicemin<<" to "<<dicemax<<"."<<endl;
					cout<<"You have a score, when you start, it is 0."<<endl;
					cout<<"In each try, you can choose to add [dice number]*["<<multi1<<" or "<<multi2<<"] to your score."<<endl;
					cout<<"If your score is more than "<<diescore<<", you will explode and die!!!"<<endl;
					cout<<"Your goal is to get the max score and survive. Good luck!"<<endl;
					cout<<">>> Back"<<endl;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==224 && ch2==77)
							{
								break;
							}
						}
					}
					system("cls");
					setpos(0,0);
					cout<<"The max sum"<<endl;
					cout<<"    Start"<<endl;
					cout<<">>> Rules"<<endl;
					cout<<"    Settings"<<endl;
					cout<<"    Stats"<<endl;
					cout<<"    Quit"<<endl;
				}
				if(cursorpos1==3)//settings
				{
					system("cls");
					setpos(0,0);
					cout<<"Settings"<<endl;
					cout<<"1. Min dice number: "<<dicemin<<endl;
					cout<<"2. Max dice number: "<<dicemax<<endl;
					cout<<"3. Multiply number 1: "<<multi1<<endl;
					cout<<"4. Multiply number 2: "<<multi2<<endl;
					cout<<"5. Dice rolls in a round: "<<tries<<endl;
					cout<<"6. Max score to keep you alive: "<<diescore<<endl;
					cout<<">>> Back"<<endl;
					cout<<"    Adjust settings"<<endl;
									
					int cursorpos2=7;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==224 && ch2==72 && cursorpos2>7)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2--;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							else if(ch1==224 && ch2==80 && cursorpos2<8)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2++;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							else if(ch1==224 && ch2==77)
							{
								if(cursorpos2==7)
								{
									break;
								}
								if(cursorpos2==8)
								{
									system("cls");
									setpos(0,0);
									cout<<"Adjust settings"<<endl;
									cout<<"Are you sure? This will clear your highscore!"<<endl;
									cout<<">>> No"<<endl;
									cout<<"    Yes"<<endl;
									int cursorpos3=2;
									while(1)
									{
										if(kbhit())
										{
											int ch1=getch(),ch2=-1;
											if(ch1/128)
											{
												ch2=getch();
											}
											if(ch1==224 && ch2==72 && cursorpos3>2)
											{
												setpos(cursorpos3,0);
												cout<<"   ";
												cursorpos3--;
												setpos(cursorpos3,0);
												cout<<">>>";
											}
											else if(ch1==224 && ch2==80 && cursorpos3<3)
											{
												setpos(cursorpos3,0);
												cout<<"   ";
												cursorpos3++;
												setpos(cursorpos3,0);
												cout<<">>>";
											}
											else if(ch1==224 && ch2==77)
											{
												if(cursorpos3==2)
												{
													break;
												}
												if(cursorpos3==3)
												{
													system("cls");
													setpos(0,0);
													cout<<"Adjust settings:"<<endl;
													cout<<">>> 1. Min dice number: "<<dicemin<<endl;
													cout<<"    2. Max dice number: "<<dicemax<<endl;
													cout<<"    3. Multiply number 1: "<<multi1<<endl;
													cout<<"    4. Multiply number 2: "<<multi2<<endl;
													cout<<"    5. Dice rolls in a round: "<<tries<<endl;
													cout<<"    6. Max score to keep you alive: "<<diescore<<endl;
													cout<<"    7. Back"<<endl;
													int cursorpos4=1;
													while(1)
													{
														if(kbhit())
														{
															int ch1=getch(),ch2=-1;
															if(ch1/128)
															{
																ch2=getch();
															}
															if(ch1==224 && ch2==72 && cursorpos4>1)
															{
																setpos(cursorpos4,0);
																cout<<"   ";
																cursorpos4--;
																setpos(cursorpos4,0);
																cout<<">>>";
															}
															else if(ch1==224 && ch2==80 && cursorpos4<7)
															{
																setpos(cursorpos4,0);
																cout<<"   ";
																cursorpos4++;
																setpos(cursorpos4,0);
																cout<<">>>";
															}
															else if(ch1==224 && ch2==77)
															{
																if(cursorpos4==7)
																{
																	break;
																}
															}
														}
														
													}
													break; 
												}
											}
										}
									}
									system("cls");
									setpos(0,0);
									cout<<"Settings"<<endl;
									cout<<"1. Min dice number: "<<dicemin<<endl;
									cout<<"2. Max dice number: "<<dicemax<<endl;
									cout<<"3. Multiply number 1: "<<multi1<<endl;
									cout<<"4. Multiply number 2: "<<multi2<<endl;
									cout<<"5. Dice rolls in a round: "<<tries<<endl;
									cout<<"6. Max score to keep you alive: "<<diescore<<endl;
									cout<<"    Back"<<endl;
									cout<<">>> Adjust settings"<<endl;
								}
							}
						}
					}
					system("cls");
					setpos(0,0);
					cout<<"The max sum"<<endl;
					cout<<"    Start"<<endl;
					cout<<"    Rules"<<endl;
					cout<<">>> Settings"<<endl;
					cout<<"    Stats"<<endl;
					cout<<"    Quit"<<endl;
				}
				if(cursorpos1==4)//stats
				{
					system("cls");
					cout<<"The max sum stats"<<endl;
					cout<<"Max score: "<<highscore<<endl;
					cout<<">>> Back"<<endl;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==224 && ch2==77)
							{
								break;
							}
						}
					}
					system("cls");
					setpos(0,0);
					cout<<"The max sum"<<endl;
					cout<<"    Start"<<endl;
					cout<<"    Rules"<<endl;
					cout<<"    Settings"<<endl;
					cout<<">>> Stats"<<endl;
					cout<<"    Quit"<<endl;
					
				}
				if(cursorpos1==5)//quit
				{
					userdata[1]="";
					puttostr(dicemin,userdata[1]);
					userdata[1]+=',';
					puttostr(dicemax,userdata[1]);
					userdata[1]+=',';
					puttostr(multi1,userdata[1]);
					userdata[1]+=',';
					puttostr(multi2,userdata[1]);
					userdata[1]+=',';
					puttostr(tries,userdata[1]);
					userdata[1]+=',';
					puttostr(diescore,userdata[1]);
					userdata[1]+=',';
					puttostr(highscore,userdata[1]);
					userdata[1]+=',';
					return;
				}
			}
		}
	}
}
//games area end
void Enter()
{
	system("cls");
	cout<<"Function Selection"<<endl;
	cout<<">>> Quit"<<endl;
	cout<<"    Games"<<endl;
	cout<<"    Tools"<<endl;
	cout<<"    Good stuffs"<<endl;
	int cursorpos1=1;
	while(1)
	{
		if(kbhit())
		{
			int ch1=getch(),ch2=-1;
			if(ch1/128)
			{
				ch2=getch();
			}
			if(ch1==224 && ch2==72 && cursorpos1>1)
			{
				setpos(cursorpos1,0);
				cout<<"   ";
				cursorpos1--;
				setpos(cursorpos1,0);
				cout<<">>>";
			}
			else if(ch1==224 && ch2==80 && cursorpos1<4)
			{
				setpos(cursorpos1,0);
				cout<<"   ";
				cursorpos1++;
				setpos(cursorpos1,0);
				cout<<">>>";
			}
			else if(ch1==224 && ch2==77)
			{
				if(cursorpos1==1)
				{
					system("cls");
					setpos(0,0);
				    cout<<"Another_Game: 6x7's game collection     account: "<<username[usernow]<<endl;
				    cout<<">>> Enter"<<endl;
				    cout<<"    Info"<<endl;
				    cout<<"    Save & Quit"<<endl;
					cout<<"    Delete your account"<<endl;
					cout<<"    Change password"<<endl;
					return;
				}
				else if(cursorpos1==2)
				{
					system("cls");
					setpos(0,0);
					cout<<"Game selection"<<endl;
					cout<<">>> Quit"<<endl;
					cout<<"    The max sum"<<endl;
					cout<<"    Devil's roulette"<<endl;
					cout<<"    Guess the number"<<endl;
					cout<<"    Oasis"<<endl;
					cout<<"    Wsmud"<<endl;
					cout<<"    Factory builder"<<endl;
					cout<<"    Piston game"<<endl;
					int number_of_games=7;
					int cursorpos2=1;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==224 && ch2==72 && cursorpos2>1)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2--;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							else if(ch1==224 && ch2==80 && cursorpos2<number_of_games+1)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2++;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							else if(ch1==224 && ch2==77)
							{
								if(cursorpos2==1)
								{
									system("cls");
									cout<<"Function Selection"<<endl;
									cout<<"    Quit"<<endl;
									cout<<">>> Games"<<endl;
									cout<<"    Tools"<<endl;
									cout<<"    Good stuffs"<<endl;
									break;
								}
								else
								{
									if(cursorpos2==2)
									{
										game_the_max_sum();
									}
									cursorpos2=1;
									system("cls");
									setpos(0,0);
									cout<<"Game selection"<<endl;
									cout<<">>> Quit"<<endl;
									cout<<"    The max sum"<<endl;
									cout<<"    Devil's roulette"<<endl;
									cout<<"    Guess the number"<<endl;
									cout<<"    Oasis"<<endl;
									cout<<"    Wsmud"<<endl;
									cout<<"    Factory builder"<<endl;
									cout<<"    Piston game"<<endl;
								}
							}
						}
					}
				}
			}
		}
	}
	return;
}
void Info()
{
	system("cls");
	setpos(0,0);
	cout<<"Another Game by 6x7"<<endl;
	cout<<"Version: 2025/10/31"<<endl;
	cout<<"Author: 6x7"<<endl;
	cout<<endl;
	cout<<"Credits:"<<endl;
	cout<<"Anyone can spread or change the code of the game"<<endl;
	cout<<"but must not delete this info."<<endl;
	cout<<endl;
	cout<<">>> Back"<<endl;
	while(1)
	{
		if(kbhit())
		{
			int ch1=getch(),ch2=-1;
			if(ch1/128)
			{
				ch2=getch();
			}
			if(ch1==224 && ch2==77)
			{
				system("cls");
				setpos(0,0);
				cout<<"Another_Game: 6x7's game collection"<<endl;
				cout<<"    Entry"<<endl;
				cout<<">>> Info"<<endl;
				cout<<"    Save & quit"<<endl;
				cout<<"    Delete your account"<<endl;
				cout<<"    Change password"<<endl;
				return;
			}
		}
		Sleep(10);
	}
}
int main()
{
	if(!launch())
	{
		return 0;
	}
	getsaving_user();
    system("cls");
    setcolor("light white");
    setpos(0,0);
    int clocknum=0;
    cout<<"Another_Game: 6x7's game collection     account: "<<username[usernow]<<endl;
    cout<<">>> Enter"<<endl;
    cout<<"    Info"<<endl;
    cout<<"    Save & Quit"<<endl;
	cout<<"    Delete your account"<<endl;
	cout<<"    Change password"<<endl;
    int cursorpos=1;
    while(1)//selcection
	{
		if(kbhit())
		{
			int ch1=getch(),ch2=-1;
			if(ch1/128)
			{
				ch2=getch();
//				ch1%=128;
			}
			if(ch1==224 && ch2==80 && cursorpos<5)
			{
				setpos(cursorpos,0);
				cout<<"   ";
				cursorpos++;
				setpos(cursorpos,0);
				cout<<">>>";
			}
			if(ch1==224 && ch2==72 && cursorpos>1)
			{
				setpos(cursorpos,0);
				cout<<"   ";
				cursorpos--;
				setpos(cursorpos,0);
				cout<<">>>";
			}
			if(ch1==224 && ch2==77)
			{
				if(cursorpos==1)
				{
				    Enter();
				}
				else if(cursorpos==2)
				{
					Info();
				}
				else if(cursorpos==3)
				{
					system("cls");
					cout<<"saving..."<<endl;
					save_user();
					cout<<"complete"<<endl;
					Sleep(1000);
					while(1)
					{
						if(kbhit())
						{
							int ch1,ch2=-1;
							ch1=getch();
							if(ch1/128)
							{
								ch2=getch();
							}
							cout<<ch1<<" "<<ch2<<endl;
						}
					}
				}
				else if(cursorpos==4)
				{
					system("cls");
					setpos(0,0);
					cout<<"Are you sure to delete your account?"<<endl;
					cout<<">>> ";
					setcolor("light green");
					cout<<"NO"<<endl;
					setcolor("dark red");
					cout<<"    I'm very sure!"<<endl;
					setcolor("light white");
					int cursorpos2=1;
					while(1)
					{
						if(kbhit())
						{
							int ch1=getch(),ch2=-1;
							if(ch1/128)
							{
								ch2=getch();
							}
							if(ch1==224 && ch2==80 && cursorpos2<2)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2++;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							if(ch1==224 && ch2==72 && cursorpos2>1)
							{
								setpos(cursorpos2,0);
								cout<<"   ";
								cursorpos2--;
								setpos(cursorpos2,0);
								cout<<">>>";
							}
							if(ch1==224 && ch2==77 && cursorpos2==1)
							{
								system("cls");
								setpos(0,0);
								cout<<"Another_Game: 6x7's game collection"<<endl;
								cout<<"    Entry"<<endl;
								cout<<"    Info"<<endl;
								cout<<"    Save & quit"<<endl;
								cout<<">>> Delete your account"<<endl;
								cout<<"    Change password"<<endl;
								break;
							
							}
							if(ch1==224 && ch2==77 && cursorpos2==2)
							{
								system("cls");
								setpos(0,0);
								cout<<"Deleting your account..."<<endl;
								char file_path[100]="another_game_user_";
								int len=username[usernow].length();
								for(int i=0;i<len;i++)
								{
									file_path[18+i]=username[usernow][i];
								}
								file_path[18+len]='.';
								file_path[19+len]='d';
								file_path[20+len]='a';
								file_path[21+len]='t';
								file_path[22+len]='a';
								file_path[23+len]='\0';
								cout<<"Deleting "<<file_path<<" ..."<<endl;
								int tmp=remove(file_path);
								if(tmp!=0)
								{
									setpos(2,0);
									cout<<"Fail to delete "<<file_path<<" ! Error code: "<<tmp<<endl;
									cout<<"Retry?"<<endl;
									cout<<">>> Yes"<<endl;
									cout<<"    Skip anyway"<<endl;
									int cursorpos3=4;
									setpos(cursorpos3,0);
									while(1)
									{
										if(kbhit())
										{
											int ch1=getch(),ch2=-1;
											if(ch1/128)
											{
												ch2=getch();
											}
											if(ch1==224 && ch2==80 && cursorpos3<5)
											{
												setpos(cursorpos3,0);
												cout<<"   ";
												cursorpos3++;
												setpos(cursorpos3,0);
												cout<<">>>";
											}
											if(ch1==224 && ch2==72 && cursorpos3>4)
											{
												setpos(cursorpos3,0);
												cout<<"   ";
												cursorpos3--;
												setpos(cursorpos3,0);
												cout<<">>>";
											}
											if(ch1==224 && ch2==77 && cursorpos3==4)
											{
												int tmp=remove(file_path);
												if(tmp==0)
												{
													break;
												}
												else
												{
													setpos(2,0);
													cout<<"Fail to delete "<<file_path<<" ! Error code: "<<tmp<<endl;
													cout<<"Retry?"<<endl;
													cout<<">>> Yes"<<endl;
													cout<<"    Skip anyway"<<endl;
												}
											}
											if(ch1==224 && ch2==77 && cursorpos3==5)
											{
												break;
											}
										}
									}
								}
								setpos(2,0);
								cout<<"                                                                                "<<endl;
								cout<<"                                                                                "<<endl;
								cout<<"                                                                                "<<endl;
								cout<<"                                                                                "<<endl;
								setpos(2,0);
								cout<<"Rewriting another_game.data..."<<endl;
								
								for(int i=1;i<=userlen-1;i++)
								{
									if(i>=userlen)
									{
										username[i]=username[i+1];
										password[i]=password[i+1];
									}
								}
								userlen--;
								save_root();
								cout<<"Rewriten another_game.data!"<<endl;
								cout<<endl;
								setcolor("light green");
								cout<<"Sucessfully removed your account!"<<endl;
								cout<<"You need to restart this program to finish."<<endl;
								setcolor("light white");
								return 0;
							}
						}
					}
				}
				else if(cursorpos==5)
				{
					system("cls");
					setpos(0,0);
					cout<<"Change password"<<endl;
					cout<<">>> Old password: "<<endl;
					cout<<"    New password: "<<endl;
					cout<<"    Confirm password: "<<endl;
					cout<<"    Save"<<endl;
					cout<<"    Quit"<<endl;
					setpos(0,0);
					int cursorpos2=1;
					int oldlen=0,passwordlen=0,comfirmpasswordlen=0;
					int loginchance=5;
					char oldnow[150]={0},passwordnow[150]={0},comfirmpasswordnow[150]={0};
					while(1)
					{
						if(_kbhit())
						{
							int input1=getch(),input2=-1;
							if(input1/128)
							{
								input2=getch();
							}
							if(input1==224 && input2==80)//down
							{
								if(cursorpos2<5)
								{
									setpos(cursorpos2,0);
									cout<<"   ";
									cursorpos2++;
									setpos(cursorpos2,0);
									cout<<">>>";
								}
							}
							else if(input1==224 && input2==72)//up
							{
								if(cursorpos2>1)
								{
									setpos(cursorpos2,0);
									cout<<"   ";
									cursorpos2--;
									setpos(cursorpos2,0);
									cout<<">>>";
								}
							}
							else if(input2==-1 && ((input1>='A' && input1<='Z') || (input1>='a' && input1<='z') || (input1>='0' && input1<='9') || input1==' ' || input1=='_'))//input
							{
								if(input1==' ')
								{
									input1='_';
								}
								if(cursorpos2==1)
								{
									setpos(cursorpos2,18+oldlen);
									cout<<(char)input1;
									oldnow[oldlen]=input1;
									oldlen++;
								}
								else if(cursorpos2==2)
								{
									setpos(cursorpos2,18+passwordlen);
									cout<<(char)input1;
									passwordnow[passwordlen]=input1;
									passwordlen++;
								}
								else if(cursorpos2==3)
								{
									setpos(cursorpos2,22+comfirmpasswordlen);
									cout<<(char)input1;
									comfirmpasswordnow[comfirmpasswordlen]=input1;
									comfirmpasswordlen++;
								}
							}
							else if(input1==8)//backspace
							{
								if(cursorpos2==1)
								{
									if(oldlen==0)
									{
										continue;
									}
									oldlen--;
									setpos(cursorpos2,18+oldlen);
									cout<<" ";
									oldnow[oldlen]=0;
								}
								else if(cursorpos2==2)
								{
									if(passwordlen==0)
									{
										continue;
									}
									passwordlen--;
									setpos(cursorpos2,18+passwordlen);
									cout<<" ";
									passwordnow[passwordlen]=0;
								}
								else if(cursorpos2==3)
								{
									if(comfirmpasswordlen==0)
									{
										continue;
									}
									comfirmpasswordlen--;
									setpos(cursorpos2,22+comfirmpasswordlen);
									cout<<" ";
									comfirmpasswordnow[comfirmpasswordlen]=0;
								}
							}
							else if(input1==224 && input2==77)//right
							{
								if(cursorpos2==4)
								{
									setpos(6,0);
									int len1=password[usernow].length();
									if(len1!=oldlen)
									{
										setcolor("light red");
										cout<<"Wrong old password!                                                "<<endl;
										loginchance--;
										cout<<"You can try "<<loginchance<<" more times.                          "<<endl;
										if(loginchance==0)
										{
											system("cls");
											cout<<"Register failed!"<<endl;
											cout<<"You enter the worng old password for too many times."<<endl;
											setcolor("light white");
											return 0;
										}
										setcolor("light white");
										continue;
									}
									int good0=1;
									for(int i=0;i<len1;i++)
									{
										if(password[usernow][i]!=oldnow[i])
										{
											good0=0;
											break;
										}
									}
									if(!good0)
									{
										setcolor("light red");
										cout<<"Wrong old password!                                                "<<endl;
										loginchance--;
										cout<<"You can try "<<loginchance<<" more times.                          "<<endl;
										if(loginchance==0)
										{
											system("cls");
											cout<<"Register failed!"<<endl;
											cout<<"You enter the worng old password for too many times."<<endl;
											setcolor("light white");
											return 0;
										}
										setcolor("light white");
										continue;
									}
									
									if(passwordlen!=comfirmpasswordlen)
									{
										setcolor("light red");
										cout<<"Password is not equal to comfirm password!                                                   "<<endl;
										cout<<"                                                                                             "<<endl;
										setcolor("light white");
										continue;
									}
									bool good=1;
									for(int i=1;i<=passwordlen;i++)
									{
										if(passwordnow[i]!=comfirmpasswordnow[i])
										{
											setcolor("light red");
											cout<<"Password is not equal to comfirm password!                                                   "<<endl;
											cout<<"                                                                                             "<<endl;
									    	setcolor("light white");
									    	good=0;
										    break;
										}
									}
									if(!good)
									{
										continue;
									}
									if(passwordlen==0)
									{
										setcolor("light red");
										cout<<"Password too short!                                          "<<endl;
										setcolor("light white");
										continue;
									}
									password[usernow]="";
									for(int i=0;i<passwordlen;i++)
									{
										password[usernow]=password[usernow]+passwordnow[i];
									}
									save_root();
									setcolor("light green");
									cout<<"You have succefully changed your password!                               "<<endl;
									cout<<"You need to restart this program.                             "<<endl;
									setcolor("light white");
									return 0;
								}
								else if(cursorpos2==5)
								{
									system("cls");
								    cout<<"Another_Game: 6x7's game collection     account: "<<username[usernow]<<endl;
								    cout<<"    Enter"<<endl;
								    cout<<"    Info"<<endl;
								    cout<<"    Save & Quit"<<endl;
									cout<<"    Delete your account"<<endl;
									cout<<">>> Change password"<<endl;
									break;
								}
							}
						}
						Sleep(10);
					}
				}
			}
		}
	    if(clock()-clocknum<50)//20 tick per second
	    {
	    	Sleep(1);
	    	continue;
		}
	}
	
	return 0;
}

评论

0 条评论,欢迎与作者交流。

正在加载评论...