-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.h
More file actions
28 lines (21 loc) · 776 Bytes
/
User.h
File metadata and controls
28 lines (21 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef USER_H
#define USER_H
#include <string>
class User {
public:
User(const std::string& username, const std::string& password, double initialBalance = 0.0);
bool authenticate(const std::string& password) const;
void saveToFile() const;
bool updateBalance(double amount); // Adjust balance
double getBalance() const;
std::string getUsername() const;
static bool userExists(const std::string& username);
static User loadUser(const std::string& username);
static void updateUserFile(const User& updatedUser); // New function to update user data in the file
private:
std::string username;
std::string passwordHash;
double balance;
std::string hashPassword(const std::string& password) const;
};
#endif