# C++20 C++20 introduces `format()`, so we can do the following. ```cpp #include #include #include int main() { for(int i=0; i<10; i++) { double x = pow(2.0,i); std::cout << std::format("Hello {}! {} {:.03f}\n", "world", i, x); } } ``` Compile with ```bash g++ -o a -std=c++20 a.cpp ``` (Note the `-sdc=c++20` as g++ uses an earlier standard by default.) # Resources * This [stackoverflow](https://stackoverflow.com/questions/2342162/stdstring-formatting-like-sprintf)