我有以下代码作为文件夹锁进行刺激:
#include<iostream>
#include<conio.h>
#include<windows.h>
#include<string>
#include<fstream>
#include<process.h>
#define max 100
using namespace std;
struct folder_all{
std::string name;
std::string location;
};
int main(){
folder_all folder[max];
int n;
cout<<"\n\n\t\t\tFolder Locker"<<endl;
if (std::ifstream("data"))
{
cout<<"\n\n\tYour Folders are safe with us"<<endl;
cout<<"Enter your password to unlock(Password will not be visible): ";
HANDLE inHandle = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(inHandle, &mode);
SetConsoleMode(inHandle, mode & ~ENABLE_ECHO_INPUT);
std::string inpass;
cin>>inpass;
SetConsoleMode(inHandle, mode);
}
else{
cout<<"\nNo. of folders to be locked: ";
cin>>n;
HANDLE inHandle = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode; …Run Code Online (Sandbox Code Playgroud) c++ ×1