For some reason this code is not correctly displaying the output....Is it a compiler issue? I'm not getting any affect from the width method, nor from the fill method. However, when I include <iomanip> and make a call to setw(int) then it works, but this code doesn't:

Code:

#include <cstdlib> #include <iostream> int main() { std::cout << "This is some text"; std::cout.width(5); std::cout.fill('*'); std::cout << "\nThis is some other text"; int x; std::cin >> x; return 0; }


NOTE: I use bloodshed

I figured this crap out. It's just that the width doesn't apply to only the fill, but to the buffer/line of text as a whole.

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.