0

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)

Bimo
  • 5,987
  • 2
  • 39
  • 61
  • It might be a duplicate... but I couldnt find it... everybody says that “ setw” right justifies your string... I need the opposite left justify with padding – Bimo Jul 01 '18 at 21:02
  • Found the answer: cout << setw(40) << left << “life” – Bimo Jul 01 '18 at 21:09

0 Answers0