online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <string> #include <format> #include <vector> std::string my_format(const std::string_view &fmt, const std::vector<std::string>& list) { std::string result; std::string::size_type start = 0, pos, end; std::vector<std::string>::size_type idx = 0; while ((pos = fmt.find('{', start)) != std::string::npos) { if (pos > start) result += fmt.substr(start, pos-start); if ((end = fmt.find('}', pos+1)) == std::string::npos) break; ++end; result += std::vformat(fmt.substr(pos, end-pos), std::make_format_args(list.at(idx++))); start = end; } if (start < fmt.size()) result += fmt.substr(start); return result; } int main() { std::cout << my_format("{} {} my name is {}", {"Hello", "World", "Dess"}); return 0; }

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