当前位置: 首页>>代码示例>>C++>>正文


C++ UserList::checkIfSame方法代码示例

本文整理汇总了C++中UserList::checkIfSame方法的典型用法代码示例。如果您正苦于以下问题:C++ UserList::checkIfSame方法的具体用法?C++ UserList::checkIfSame怎么用?C++ UserList::checkIfSame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserList的用法示例。


在下文中一共展示了UserList::checkIfSame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: menu

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 = "password";
		string username = "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();
		}

	}
开发者ID:shawwshank,项目名称:projects,代码行数:85,代码来源:asd.cpp


注:本文中的UserList::checkIfSame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。