#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main(){
string cmd,pwd;
int lng = 0;
string low = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
string med = "Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9KkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
string high = "Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9Kk!Ll@Mm#Nn$Oo%Pp^Qq&Rr*Ss(Tt)Uu_Vv-Ww+Xx=YyZz";
string super = "[A!a@B#b$C^c%D&d*E(e)F{f}G`g~H:h;I'i|J<j>K,k.L/l?M\m=N+n-O_o1P2p3Q4q5R6r7S8s9T0tUuVvWwXxYyZz]";
gen:
cout << "how strong? low, med, high, or super? ";
cin >> cmd;
cout << "how many characters should it be? ";
cin >> lng;
if(cmd=="low"){
for(int i = 0; i < lng; ++i){
pwd += low[rand() % (low.length())];
}
cout << pwd.c_str() << endl;
cin.get();
}
if(cmd=="med"){
for(int i = 0; i < lng; ++i){
pwd += med[rand() % (med.length())];
}
cout << pwd.c_str() << endl;
cin.get();
}
if(cmd=="high"){
for(int i = 0; i < lng; ++i){
pwd += high[rand() % (high.length())];
}
cout << pwd.c_str() << endl;
cin.get();
}
if(cmd=="super"){
for(int i = 0; i < lng; ++i){
pwd += super[rand() % (super.length())];
}
cout << pwd.c_str() << endl;
cin.get();
}
if(cmd==""){
cout << "invalid input!" << endl;
}
pwd.clear();
goto gen;
return 0;
}

string Pattern;
//U can still use the if {}
If(cmd = "low") Pattern = low;
//use elseif to avoid unneed reevaluation
ElseIf (cmd = "mid") //...
//but when u have a bunch of if/elseif, use select
switch(cmd)
{
case "low" : Pattern = low;
//..
default : cout << "unvalid something something"<<endl;
}
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main(){
char ret;
int str,len;
string PWStrength[] = {"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",
"Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9KkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",
"Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9Kk!Ll@Mm#Nn$Oo%Pp^Qq&Rr*Ss(Tt)Uu_Vv-Ww+Xx=YyZz",
"[A!a@B#b$C^c%D&d*E(e)F{f}G`g~H:h;I'i|J<j>K,k.L/l?M\m=N+n-O_o1P2p3Q4q5R6r7S8s9T0tUuVvWwXxYyZz]" };
while(true)
{
cout << "how strong?" << endl << "1- low" << endl << "2- med," << endl << "3- high" << endl << "4- super" <<endl;
while(true)
{
cin >> str;
if (0 <= str & str <= 3) break; //validing index
cout << "Please input a valid number between 1 and 4" << endl;
}
while(true)
{
cout << "how many characters should it be? " << endl;;
cin >> len;
if (6 <= len & len <= 32) break;
}
for(int i = 0; i < len; i++)
cout << PWStrength[str][rand() % PWStrength[str].length()];
cout << endl;
while(true)
{
cout << "Generate another PW? Y/N" << endl;
cin >> ret;
switch(toupper(ret))
{
case 'Y' : break;
case 'N' : return 0;
default : continue;
}
}
}
return 0;
}
