int main(int argc, const char * argv[]) { // make a usernetworklist UserNetwork test; string username = ""; test.addUser("krishna", "sup", "Krishna Ling", "S"); test.addUser("vince", "hi", "Vince Gan", "Be"); test.addUser("vince2", "hi2", "Vince Gan2", "Be2"); test.addUser("vince3", "hi3", "Vince Gan3", "Be3"); test.addUser("vince4", "hi4", "Vince Gan4", "Be4"); test.WriteToFileUserList(); test.readFromFile("./userList.txt"); //cout << test.returnUser("krishna").userInfoString(); //cout << test.returnUser("vince").userInfoString(); test.sendRequest("vince", "krishna"); test.sendRequest("vince", "vince2"); test.sendRequest("vince", "vince3"); test.sendRequest("vince", "vince4"); test.acceptRequest("krishna", "vince"); test.acceptRequest("vince2", "vince"); test.acceptRequest("vince3", "vince"); test.acceptRequest("vince4", "vince"); cout << test.returnUser("vince").printFriendsList() << endl; // int counter; // if counter = 1 then password exists // string yourpass; // cout << "Enter Password: "******"Password exists" << endl; // return 0; // } // itr++; // } // // // if(counter !=1){ // cout << "Password does not exist"<< endl; // } return 0; }
void createUser() { string username, firstname, lastname, password; int date[3] = { 0, 0, 0 };//day, month, year; cout << "Creating new user account" << endl; cout << "Enter desired username: "******"Username taken." << endl; else { cout << "Please enter a password: "******"Please enter your first name: "; cin >> firstname; cout << "Please enter your last name: "; cin >> lastname; cout << "Enter your date of birth." << endl; cout << "Day: (dd) "; while (!(cin >> date[0]) || date[0] > 31 || date[0] < 1) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Please input a valid day: " << endl; } cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Month: (mm) "; while (!(cin >> date[1]) || date[1] > 12 || date[1] < 1) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Please input a valid month: " << endl; } cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Year: (yyyy) "; while (!(cin >> date[2]) || date[2] > 2015 || date[2] < 1900) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Please input a valid year: " << endl; } cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); stringstream formatString; formatString << username << " " << password << " " << firstname << " " << lastname << " " << date[0] << " " << date[1] << " " << date[2]; User newUser(formatString.str()); // cout << formatString.str() << endl; usernetwork.addUser(newUser); //usernetwork.printUsers(); cout << "User has been added successfully." << endl; } }