Is there a way to center align "text"using cout<< in regards to the console screen position?
thanks
Is there a way to center align "text"using cout<< in regards to the console screen position?
thanks
Find the length of the text. Subtract that from the width of the output line (usually 80 in a console window). Output half that number blanks before outputting the text, or use setw( ).
Find the length of the text. Subtract that from the width of the output line (usually 80 in a console window). Output half that number blanks before outputting the text, or use setw( ).
of course u should include:
#include <iomanip>
otherwise wont work
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.