Hello! I made a post before about dialog box in Windows using C++, I deleted it ,I realized how stupid it was. What I want now is to know how to make a program that will ask me for my password and username and if they are correct a folder or something will open. I want to know this for my work, not to copy,to understand ,Thank you.
#include <iostream>
#include <string>
usingnamespace std;
int main(){
string attempt; // what the user enters
string password = "man"; // actual password
cout << "Enter password (0 to exit) and press ENTER: ";
while (true){
getline(cin, attempt);
cout << endl;
if (attempt[0] == '0')
break;
if (attempt == password){
cout << "correct!"; // revise to what you want done here, probably call a function
break;
}
else
cout << "Incorrect, retry (0 to exit): ";
}
cin.get();
return 0;
}
No I don`t want to lock a folder , I just want to enter a password and username and whne they are correct something will pop-up. Thank you For your support!!!