64 lines
979 B
C++
64 lines
979 B
C++
![]() |
//#include "main.cpp"
|
||
|
#include <fstream>
|
||
|
#include <iostream>
|
||
|
#include <sstream>
|
||
|
#include <string>
|
||
|
|
||
|
bool password = true; // temp for a password needed function needed later.
|
||
|
string pass = "admin";
|
||
|
|
||
|
void setPassword()
|
||
|
{
|
||
|
password = !password;
|
||
|
}
|
||
|
|
||
|
vector<string> tokenize(string ss){
|
||
|
string tempString;
|
||
|
stringstream lineStream(ss);
|
||
|
vector<string> output;
|
||
|
|
||
|
while (lineStream >> tempString){
|
||
|
output.push_back(tempString);
|
||
|
}
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
void parseCmd(vector<string> input){
|
||
|
if(password){
|
||
|
if(pass == input[0]){
|
||
|
setPassword();
|
||
|
cout << "Success." << endl;
|
||
|
}
|
||
|
else{
|
||
|
cout << "Incorrect Password." << endl;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
string cmd = toupper(input[0]);
|
||
|
|
||
|
else if(cmd == ""){
|
||
|
|
||
|
}
|
||
|
|
||
|
else if(cmd == ""){
|
||
|
|
||
|
}
|
||
|
|
||
|
else if(cmd == ""){
|
||
|
|
||
|
}
|
||
|
|
||
|
else if(cmd == ""){
|
||
|
|
||
|
}
|
||
|
|
||
|
else if(cmd == ""){
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void parse(string input){
|
||
|
vector<string> listOfTokens = tokenize(input);
|
||
|
parseCmd(listOfTokens);
|
||
|
}
|