cpp string formatting code example
Example 1: format string cpp
#include
#include
int main() {
std::cout << std::format("Hello {}!\n", "world");
}
Example 2: c++ formatting
cout << setw(10) << "ten" << "four" << "four" << '\n';
// Display ten fourfour
cout << setfill('-') << setw(80) << "-" << '\n';
// Displays 80 "-"