You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Function to encrypt the password using a simple Caesar Cipher (shift by 3)
string encryptPassword(string password) {
for (char &ch : password) {
ch += 3; // Shift each character by 3 positions
}
return password;
}
int main() {
string username, email, password;
ofstream file;
cout << "=== Sign Up Page ===" << endl;
// Get user details
cout << "Enter username: ";
getline(cin, username);
cout << "Enter email: ";
getline(cin, email);
cout << "Enter password: ";
getline(cin, password);
// Encrypt the password
string encryptedPassword = encryptPassword(password);
// Save user data to file
file.open("users.txt", ios::app);
if (!file) {
cout << "Error opening file!" << endl;
return 1;
}
file << username << "," << email << "," << encryptedPassword << endl;
file.close();
cout << "Sign-up successful! Your details have been saved." << endl;
return 0;
}
The text was updated successfully, but these errors were encountered:
#include
#include
#include
using namespace std;
// Function to encrypt the password using a simple Caesar Cipher (shift by 3)
string encryptPassword(string password) {
for (char &ch : password) {
ch += 3; // Shift each character by 3 positions
}
return password;
}
int main() {
string username, email, password;
ofstream file;
}
The text was updated successfully, but these errors were encountered: