Commit c57125b9 authored by khy724's avatar khy724

feat: The Better Idea

parent 8eca7243
File added
#include<iostream>
#include"utils.h"
#include <iostream>
#include "utils.h"
#include <string>
using namespace std;
int main() {
char* nm, pwd;
string nm, pwd;
cout<<"Enter your name"<<endl;
cin>>nm;
cout<<"Enter your password"<<endl;
......
......@@ -3,10 +3,11 @@
#include<map>
#include<string>
#include<vector>
using namespace std;
map<string, string> passwords {
/*map<string, string> passwords {
{"Tinsmorem","Iltil"},
{"Ulyglet","Snurgrurg"},
{"Lafibnom","Diamdioc"},
......@@ -28,16 +29,76 @@ map<string, string> passwords {
{"Fensmyl","Vrakniarth"},
{"Pibkecim","Jerpuldo"}
};
*/
map<string, int> userids {
{"Tinsmorem",0},
{"Ulyglet",1},
{"Lafibnom",2},
{"Thenbovir",3},
{"Gallnip",4},
{"Froolvess",5},
{"Smameknuc",6},
{"Smedekmet",7},
{"Cebbnec",8},
{"Klolyddwac",9},
{"Blivylnas",10},
{"Glyhamdas",11},
{"Hillnar",12},
{"Phieddlu",13},
{"Fnamdyn",14},
{"Fladnivith",15},
{"Phelnyll",16},
{"Snallbam",17},
{"Fensmyl",18},
{"Pibkecim",19},
};
vector<string> passwords {
"Iltil",
"Snurgrurg",
"Diamdioc",
"Oudrarrouz",
"Haulmi",
"Holdiz",
"Hinnyual",
"Traolbubrorg",
"Khishohi",
"Maennius",
"Jolmuulmohr",
"Drustiel",
"Nanruddiarth",
"Zussial",
"Laszo",
"Nathentoih",
"Phorughoelle",
"Skilzeda",
"Vrakniarth",
"Jerpuldo"
};
//Return true only if the person is present in the database
bool find_user(string name){
/*bool find_user(string name){
if(passwords.find(name) != passwords.end()) return true;
else return false;
}
}*/
//Returns the password for a particular person
string get_password(string name){
/*string get_password(string name){
return passwords[name];
}*/
bool find_userid(string name){
if(userids.find(name) != userids.end()) return userids[name];
else return -1;
}
string get_password(string name){
int user_id = -1;
if((user_id = find_userid(name)) < 0) return "";
else return passwords[user_id];
}
#endif
File added
#include<iostream>
#include"password.h"
#include "passwords.h"
#include<string>
#include<vector>
using namespace std;
map<strings,strings> passwords;
//vector<string,string> passwords;
bool login(string name, string password) {
if(passwords.find(name) != passwords.end() && passwords[name]==password) return true;
else return false;
if( get_password(name)==password) return true;
else return false;
}
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment