I'm trying to write simple encryption, please take look at below code I expecting it return
hello
by map with mapOfWords array
How to write decode function so, it return string as I'm expecting
#include <iostream>
#include <string>
#include <map>
using namespace std;
std::string decode(const std::string& input) {
std::map<std::string, std::string> mapOfWords;
mapOfWords["d2"] = "h";
mapOfWords["a3"] = "e";
mapOfWords["c2"] = "l";
mapOfWords["72"] = "l";
mapOfWords["84"] = "o";
std::string result = input;
return result;
}
int main(int argc, char** argv) {
std::string sot = decode("\xd2\xa3\xc2\x72\x84");
std::cout << sot << std::endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire