Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign up page.c #4

Open
kuldeepRathod9136 opened this issue Mar 8, 2025 · 0 comments
Open

Sign up page.c #4

kuldeepRathod9136 opened this issue Mar 8, 2025 · 0 comments

Comments

@kuldeepRathod9136
Copy link

#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;

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;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant