LogIn - Steam Library

PHOTO EMBED

Wed Jun 08 2022 08:48:25 GMT+0000 (Coordinated Universal Time)

Saved by @Enigma #c++

#include "SteamLibrary.h";

string userName;
string passWord;

string userA = "";
string userB = "";
string userC = "";
string userD = "";
string userE = "";

string passA = "";
string passB = "";
string passC = "";
string passD = "";
string passE = "";

string loginUserInfo[5] = { userA, userB, userC, userD, userE };
string loginPassInfo[5] = { passA, passB, passC, passD, passE };

steamLibrary sl;

int main()
{
	sl.loginPage();
}

void steamLibrary :: loginPage()
{
	string loginInput;

	cout << "Login page\nA) Login\nB) Signup\n";
	cin >> loginInput;

	if (loginInput == "A")
	{
		sl.login();
	}
	if (loginInput == "B")
	{
		sl.signup();
	}
	else if (loginInput != "A" || loginInput != "B")
	{
		cout << "Please answer with either A or B\n";
		sl.loginPage();
	}
}

void steamLibrary :: login()
{
	cout << "Please enter your Username\n";
	cin >> userName;
	cout << "Please enter your Password\n";
	cin >> passWord;

	for (int i = 0; i < 5; i++)
	{
		if (userName == loginUserInfo[i])
		{
			if (passWord == loginPassInfo[i])
			{
				sl.libraryInput();
			}
			else
			{
				cout << "Please try again\n";
				sl.loginPage();
			}
		}
		else
		{
			cout << "Please try again\n";
			sl.loginPage();
		}
	}
}

void steamLibrary :: signup()
{
	if (loginUserInfo[4] != "")
	{
		cout << "There are too many accounts at this time, please try again later or login\n";
		sl.loginPage();
	}

	cout << "Please create a new Username\n";
	cin >> userName;
	for (int i = 0; i < 5; i++)
	{
		if (userName == loginUserInfo[i])
		{
			cout << "Sorry but that is taken\n";
			sl.login();
		}
	}

	for (int o = 0; o < 5; o++)
	{
		if (loginUserInfo[o] == "")
		{
			loginUserInfo[o] = userName;

			cout << "Please create a Password\n";
			cin >> loginPassInfo[o];

			sl.loginPage();
			o = 6;
		}
	}
}

void steamLibrary :: libraryInput()
{
	string libraryInput;

	cout << "Welocme to the your Game Library\nWould you like to A)Sign out or B)Go to your Game Library?\n";
	cin >> libraryInput;

	if (libraryInput == "A")
	{
		sl.loginPage();
	}
	if (libraryInput == "B")
	{
		sl.gameLibrary();
	}
	else if (libraryInput != "A" || libraryInput != "B")
	{
		cout << "Please answer with either A or B\n";
		sl.libraryInput();
	}
}

void steamLibrary :: gameLibrary()
{
	string gameChoice;

	cout << "Game Library\nWould you like to view...\nA)Buba-G\nB)Two weeks\nor C)SUWI\n...and if you are done here type D to leave.";
	cin >> gameChoice;

	if (gameChoice == "A")
	{
		sl.bubaG();
	}
	if (gameChoice == "B")
	{
		sl.twoWeeks();
	}
	if (gameChoice == "C")
	{
		sl.suwi();
	}
	if (gameChoice == "D")
	{
		sl.libraryInput();
	}
	else if (gameChoice != "A" || gameChoice != "B" || gameChoice != "C" || gameChoice != "D")
	{
		cout << "Please answer with either A, B or C\n";
		sl.gameLibrary();
	}
}

void steamLibrary :: bubaG()
{
	string libraryReturn;

	cout << "Buba-G:\n	-This all new Battleroyal released by Mysterious People, is a realistic shooter in a Player vs Player environment where the only objective is to win\n	-The age rating of this game is 18\n	-Currently the only two playable characters are Jack the crack and Lord Lynham, but we all know who is the best...\n If you want to return to the Library please type A";
	cin >> libraryReturn;

	if (libraryReturn == "A")
	{
		sl.gameLibrary();
	}
	else
	{
		cout << "If you wish to return to the Library please type A";
		sl.bubaG();
	}
}

void steamLibrary::twoWeeks()
{
	string libraryReturn;

	cout << "Two Weeks:\n	-This game is about how zombies have taken over the world and the most physically fit man must survive two weeks in this world and wait till rescue, who are these men? Dan Lynham a.k.a 'Lyndog'\n	-The age rating of this game is 15\n	-Currently the game will recieve it's first DLC soon\n	If you want to return to the Library please type A";
	cin >> libraryReturn;

	if (libraryReturn == "A")
	{
		sl.gameLibrary();
	}
	else
	{
		cout << "If you wish to return to the Library please type A";
		sl.twoWeeks();
	}
}

void steamLibrary::suwi()
{
	string libraryReturn;

	cout << "SUWI:\n	-D-Street, humanities last hope against the vegan crisis and must ultimately kill his only rival, Dan Lynham\n	-The age rating for this is 12\n	The total game time for this game is 3 minutes as a fight between these two wouldn't last that long\n	If you want to return to the Library please type A";
	cin >> libraryReturn;

	if (libraryReturn == "A")
	{
		sl.gameLibrary();
	}
	else
	{
		cout << "If you wish to return to the Library please type A";
		sl.suwi();
	}
}
content_copyCOPY