diff --git a/morse/main.cc b/morse/main.cc index db97661..e2a7610 100644 --- a/morse/main.cc +++ b/morse/main.cc @@ -5,8 +5,8 @@ int main() { Morse_code mc{"morse.def"}; std::cout << mc.encode("Hello Morse") << "\n"; // .... . .-.. .-.. --- -- --- .-. ... . -// std::cout << mc.decode("... --- ...") << "\n"; -// std::cout << mc.decode(".... ----") << "\n"; // ---- is not a valid code -// std::cout << mc.decode(mc.encode("loopback test")) << "\n"; + std::cout << mc.decode("... --- ...") << "\n"; + std::cout << mc.decode(".... ----") << "\n"; // ---- is not a valid code + std::cout << mc.decode(mc.encode("loopback test")) << "\n"; // } diff --git a/morse/morse_code.cc b/morse/morse_code.cc index 36ec13a..4950f83 100644 --- a/morse/morse_code.cc +++ b/morse/morse_code.cc @@ -31,7 +31,7 @@ std::string Morse_code::decode(std::string str) { std::string s; while(in >> s) { - auto it = std::find_if(morse_map.begin(), morse_map.end(), [&](std::pair &p) { + auto it = std::find_if(morse_map.begin(), morse_map.end(), [&](std::pair &p) { return p.second == s; });