Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- using namespace std;
- bool is_user = false,startDatabase = false;
- string file_text;
- string username;
- string password;
- string repeat_password;
- bool isCorrect = false;
- int main(int argc, char const *argv[])
- {
- ofstream setText("user_data.txt");
- ifstream getText("user_data.txt");
- getText.getline(file_text,10);
- if(file_text == ""){
- while(!isCorrect){
- cout << "For using our dataBase, please enter data for
- privacy nUsername : ";
- cin >> username;
- cout << "Password : ";
- cin >> password;
- cout << "Repeat password : ";
- cin >> repeat_password;
- if(password == repeat_password){
- isCorrect = true;
- }else{
- cout << "Please, repeat and enter identistic passwords!";
- isCorrect = false;
- }
- }
- setText << username << password;
- }else{
- int data_count_username = username.length();
- int data_count_password = password.length();
- string pass_password;
- string pass_username;
- cout << "Please enter your data " << endl << "Username : ";
- cin >> username;
- cout << "Password : ";
- cin >> password;
- getText.getline(pass_username,data_count_username);
- getText.getline(pass_password, data_count_password);
- if(pass_username == username && pass_password == password){
- startDatabase = true;
- }
- }
- setText.close();
- getText.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment