Homework 2 - Spring 2023 Semester
Deadline: Monday Esfand 29st - 11:59 pm
In this homework we are going to implement a Login and Register class in c++.
We will be implementing all our functions in hw2.cpp
and hw2.h
. remember you should put all declarations in the .h
and all the implementations in the .cpp
file.
We have two struct, Login and User. Login Struct has two vector of pointers of user to store users and registered users.
Now, lets discuss each functions and see how they should be implemented.
-
User constructor and Destructor implement this functions in hw2.cpp.
-
User constructor and Destructor implement this functions in hw2.cpp.
-
registerUser implement this function so that it will create a user if doesn't exist another user with this username and password. for check this, implement checkEmail and checkUsername.
void registerUser(std::string username, std::string password, std::string email);
-
loginUser implement this function so that it will user logged in.
void loginUser(std::string username, std::string password);
-
getUser
implement this function so that it returns pointer of user with given username.
User* getUser (std::string username);
-
removeUser
implement this function so that it remove user from our lists.
void removeUser(std::string username);
-
**changeMail, changePassword, changeUsername **
-
readFile implement this function so that it will read data from txt file and generate users and loggined status.
void readFile(std::string path);
As mentioned before, keep all your implementations in hw1.cpp
and hw1.h
. do not alter other files at all. In case you want to test your code you may only use the debug
section of the main.cpp
.
if (true) // make false to run unit tests
{
// debug section
}
else {
::testing::InitGoogleTest(&argc, argv);
std::cout << RUN_ALL_TESTS() << std::endl;
}
GOOD LUCK