<commit_before>/*
 *	Written by   : <NAME>
 *	Last edited  : 5/12/2016
 */

#include <iostream>
#include <string>
#include <stack>
#include <fstream>
#include "Person.cpp"
using namespace std;

//Declaration of functions
void getUser(string);
void login();
void adminLogin();
void loggedIn();
void registration();
void editCredentials();
void update(Person);
void chgUsername();
void chgPassword();
void chgEmail();
void chgPhoneNo();
void quit();

//Stacks to store the data
stack<Person> users;

//Declaration of place holding variables
Person currentUser;
string username;
string password;
string password2;
string email;
string phoneNo;
int wrongPass = 0;

int main()
{
	ifstream fin("database.txt");
	int choice;

	while (!fin.eof())
	{
		fin >> username >> password >> email >> phoneNo;
		Person temp(username, password, email, phoneNo);
		users.push(temp);
	}

	users.pop();

	cout << "Please choose one of the following options :" << endl;
	cout << "Log In       - 1" << endl;
	cout << "Registration - 2" << endl;
	cout << "Exit         - 0" << endl;

	cin >> choice;
	switch (choice)
	{
	case 1:
		login();
		break;
	case 2:
		registration();
		break;
	case 0:
		break;
	}

	ofstream fout("database.txt");

	while (!users.empty())
	{
		fout << users.top().getName() << " " << users.top().getPassword() << " " << users.top().getEmail() << " " << users.top().getPhoneNo() << " " << endl;
		users.pop();
	}

  return 0;
}

void getUser(string query)
{
	stack<Person> temp = users;<commit_msg>main commented<commit_after>/*
 *	Written by   : <NAME>
 *	Last edited  : 5/12/2016
 */

#include <iostream>
#include <string>
#include <stack>
#include <fstream>
#include "Person.cpp"
using namespace std;

//Declaration of functions
void getUser(string);
void login();
void adminLogin();
void loggedIn();
void registration();
void editCredentials();
void update(Person);
void chgUsername();
void chgPassword();
void chgEmail();
void chgPhoneNo();
void quit();

//Stacks to store the users' personal data
stack<Person> users;

//Declaration of place holding variables
Person currentUser;
string username;
string password;
string password2;
string email;
string phoneNo;
int wrongPass = 0;

int main()
{
	//Reading from file to build the database
	ifstream fin("database.txt");
	while (!fin.eof())
	{
		//Reading in line-by-line into the placeholding variables
		fin >> username >> password >> email >> phoneNo;

		//Create the Person and push it into the stack
		Person temp(username, password, email, phoneNo);
		users.push(temp);
	}

	//Pop off the additional data added into the stack due to the empty line
	users.pop();

	getOption:
	//Display user input options
	cout << "Please choose one of the following options :" << endl;
	cout << "Log In       - 1" << endl;
	cout << "Registration - 2" << endl;
	cout << "Exit         - 0" << endl;

	//Get user input
	int choice;
	cin >> choice;

	//Switch according to user input
	switch (choice)
	{
	case 1:
		login();
		break;
	case 2:
		registration();
		break;
	case 0:
		break;
	default:
		//Display error message
		cout << "Invalid input. Please try again." << endl;
		goto getOption;
	}

	//Saving data into file
	ofstream fout("database.txt");

	//Check if the stack is empty
	while (!users.empty())
	{
		//Move the data into the files each Person per line
		fout << users.top().getName() << " " << users.top().getPassword() << " " << users.top().getEmail() << " " << users.top().getPhoneNo() << " " << endl;
		//Pop the Person out of stack after the data is moved
		users.pop();
	}

	//End the program
  return 0;
}

void getUser(string query)
{
	stack<Person> temp = users;
{'fraction_non_alphanumeric': 0.15191618417424868, 'fraction_numerical': 0.008822718500137855, 'mean_word_length': 3.7239583333333335, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1148444', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1164, 'n_words': 399}