how do you align a text being shown like to the middle or the right?
how do you align a text being shown like to the middle or the right?
use gotoxy or other text spacing functions.
in graphics.h there is centre_text,vert_dir etc etc..
-
thanks for the reply bud but...i am the newbiest of the newbies...i dunnos what you just said =)
im trying to create a program where it asks you to input anything and it will print of the screen what you just typed but instead, its aligned or justified to the right...
also i read another topic where it says you can't or have to set a number of spaces to justify something to the right. is that true?
I read that you can have anything a certain number of spaces somewhere... let me find it... here it is
The manipulator to set something a certain number of spaces out it setw(# of spaces out)
in order for setw to work, you need to include <iomanip.h>.
here's how it would work
#include <iostream.h>
#include <iomanip.h>
int main(void)
{
int a, b, c;
cout <<"please enter three numbers with different numbers of digets\n";
cin >>a>>b>>c;
cout <<"your numbers were, in reverce order:\n" << setw(5)<<c<<"\n"<<setw(5)<<b<<"\n"<<setw(5)<<a<<"\ n";
return 0;
}
well, very simple, but I think this is what you were looking for.