how do i go about outputting text let alligned 12 spaces from the margin? i have been looking into setf but that is a padded output and i want my output to be 12 spaces from the margin and go on from there no matter how long it is
<-12 wide-->Hours worked
i know its something quite simple but i cant put my finger on it :p
//doesnt quite work as the string is too long so its pushed back agains the margin
you could just do.....
yes but then that would be cheating :p lol i want to do it the right way plus adding spaces is time consuming and a bad idea if i ever have to change the spaces between :p
Originally posted by Stoned_Coder you could just do.....
Check for a newline character. If one is found output x spaces.
well use a combination of right and setw() but i tell you its gonna be easier to print 12 spaces lol.
btw if you are on windows console theres a cheat....
void gotoxy(const int x,const int y)
are you sure there isnt a function specificly for this?
you can use right and setw(12+numcharsinwhateverurprinting)
or am I missing something?
cout << setw(12) << "" << "Hours Worked" << endl;
(edit) No, it seems to work.