C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-21-2002, 06:20 PM   #1
Registered User
 
Join Date: Feb 2002
Posts: 2
how to align text?

how do you align a text being shown like to the middle or the right?
kuyajay is offline   Reply With Quote
Old 02-21-2002, 08:49 PM   #2
I'm Back
 
Join Date: Dec 2001
Posts: 556
use gotoxy or other text spacing functions.

in graphics.h there is centre_text,vert_dir etc etc..
__________________
-
ihsir is offline   Reply With Quote
Old 02-21-2002, 09:18 PM   #3
Registered User
 
Join Date: Feb 2002
Posts: 2
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?
kuyajay is offline   Reply With Quote
Old 02-22-2002, 02:51 AM   #4
Registered User
 
Join Date: Feb 2002
Posts: 33
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.
Dummies102 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My text doesn't display joeprogrammer Game Programming 11 02-23-2006 10:01 PM
Appending text to an edit control dit6a9 Windows Programming 3 08-13-2004 09:52 PM
Text positioning and Text scrolling RealityFusion C++ Programming 3 08-13-2004 12:35 AM
Scrolling The Text GaPe C Programming 3 07-14-2002 04:33 PM
MFC. displaying text in a label recieved from a Edit Field box gazza C++ Programming 1 07-13-2002 05:45 PM


All times are GMT -6. The time now is 02:26 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22