online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <string> #include <sstream> #include <vector> std::vector<std::string> split(const std::string& input, char delimiter) { std::istringstream stream(input); std::string field; std::vector<std::string> result; while (std::getline(stream, field, delimiter)) { result.push_back(field); } if (input.empty() || input.back() == delimiter) { result.push_back(""); } return result; } void test(const std::string& input) { std::cout << "'" << input << "'" << " => ["; for (const std::string& s : split(input, ',')) { std::cout << "'" << s << "', "; } std::cout << "]" << std::endl; } int main() { test("aaa,bbb,ccc"); test("aaa,bbb,,ccc"); test("aaa,bbb,ccc,"); test("aaa"); test(""); }

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