Imagine there are many statement and messages to write out on the screen
cout << "statement A :" << a << "\t statement B :" << B
<< "\t statement C :" << C << "\t statement D :" << D;
in C# you’d write:
Console.WriteLine(
"statement A :{0}\t statement B :{1}\t statement C :{2}\t statement D :{3}",
a, b, c, d);
it is like printf in C# but I don’t want to use C statements in my program; is there a way to write fewer << in C++ without using printf?
Use
boost::formatfor example.So in C# it was
Console.WriteLine("statement A: {0}\t...", a, b, c, d);