online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <string> #include <vector> #include <map> std::vector<std::string> remove_even_strings(std::vector<std::string>& ref); void print_vector(std::vector<std::string> & ref); int main() { std::vector<std::string> vec; vec.push_back("abc"); vec.push_back("123"); vec.push_back("456"); vec.push_back("fgh"); vec.push_back("ppp"); vec.push_back("123"); vec.push_back("fgh"); vec.push_back("fgh"); vec.push_back("abc"); vec.push_back("ppp"); print_vector(vec); auto result = remove_even_strings(vec); print_vector(result); return 0; } std::vector<std::string> remove_even_strings(std::vector<std::string> & ref) { std::vector<std::string> result; std::map<std::string, size_t> srch; for (auto & r : ref) { auto t = srch.insert(std::make_pair(r, 1)); if (t.second == false) { srch.at(r) = srch.at(r) + 1; } } for (auto & r : ref) { if (srch.at(r) % 2 == 1) { result.push_back(r); } } return result; } void print_vector(std::vector<std::string> & ref) { for (auto & r : ref) { std::cout << r << std::endl; } std::cout << "----------" << std::endl; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue