Beispiel #1
0
void menu(int choice, bool &goBackToFirstMenu, UserList &dataList)
{
	while(choice != 1 && choice != 2 && choice != 3 && choice != 4) //if user enters something other than 1,2,3
	{
		cout << "Please enter a correct number." << endl;
		cin >> choice;
	}

	if(choice == 1)
	{
		checkUsername(dataList);
	}
	else if(choice == 2)
	{
		bool checkIfExists;
		User newuser;
		cout << "Hi! You are about to create a new user." << endl;
		cout << endl;
		cout << "What is the user's name?" << endl;
		string newName;
		getline(cin, newName);
		getline(cin, newName);
		newuser.setName(newName);
		cout << "Make a username for yourself! (Remember, no spaces in usernames)" << endl;
		string newUserName;
		cin >> newUserName;
		newuser.setUsername(newUserName);
		checkIfExists = dataList.checkIfSame(newUserName);
		while(checkIfExists == true)
		{
			cout << "Try entering another username" << endl;
			string enterNewName;
			cin >> enterNewName;
			newuser.setUsername(enterNewName);
			checkIfExists = dataList.checkIfSame(enterNewName);
		}
		//cout << endl;
		cout << "Make your own password! (remember, no spaces!)" << endl;
		string newPassword;
		cin >> newPassword;
		cout << "For security purposes, please enter your password again." << endl;
		string checkNewPassword;
		cin >> checkNewPassword;
		while(newPassword != checkNewPassword)
		{
			cout << "Please enter your password again!" << endl;
			cin >> checkNewPassword;
		}
		newuser.setPassword(newPassword);
		//cout << endl;
		cout << "Now for the third element, please type which university you go to!" << endl;
		string newUniversity;
		getline(cin,newUniversity);
		getline(cin,newUniversity);
		cout << endl;
		newuser.setUniversity(newUniversity);
		cout << "Your university is " << newUniversity << "!" << endl;
		cout << endl;

		dataList.addUser(newuser);
		User addANewUser;
		string university = "USC";
		string password = "******";
		string username = "******";
		string comment = "COMMENT";
		string comment1 = "HEY WHATS UP";
		string randomizing;
		for(int i = 0; i < 10000; i++)
		{
			randomizing = generatingRandom();
			addANewUser.setUsername(randomizing);
			addANewUser.setPassword(password);
			addANewUser.setUniversity(university);
			//addANewUser.addPostAutomatic(username, comment);
			addANewUser.addPostAutomatic(username, comment1);
			//dataList.addUser(addANewUser);
			//addANewUser.
			for(int j = 0; j < 100; j++)
			{
				//addANewUser.addFriends()
			}
			//dataList.writeFile();
		}

	}