For my (online) programming class, I have to format certain output in columns using setw. I am having trouble understanding how to do this. My professor says that I am supposed to be creating columns, not counting characters to align things. I haven't been able to find any examples of this online. I've been doing something similar to this to align things:

cout << setw(10) << someVarible << setw(15) << someOtherVarible << setw(20)
     << anotherVarible;

Apparently, this is not the way I am supposed to do this, and I've gotten points taken off on my assignments because of this. How exactly to I create columns using setw? Any help would be greatly appreciated.

Silly question but can't you have your teacher explain what you should have done not to have points taken off? It is hard for us to know what he is thinking.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.