本文整理汇总了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();
}
}