dimanche 1 juillet 2018

What is C++ equivalent of “%-[width]s” for cout stream? [duplicate]

This question already has an answer here:

Here’s what i normal do in c code:

Printf(“%-40s = 42\n”, “life”)

“Life”will be left justified with spaces padding on right...

How can I accomplish the same thing in c++ cout style code?

(Sorry... I’ve been dragging my feet for years when it comes to use using cout over printf)

Aucun commentaire:

Enregistrer un commentaire