Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
What code lines will I need to type for simple text information to appear in program as a title, header etc...
Ex: My name, program name, date ...
Thanks

Well, I guess I'm not really sure what you're asking...
If your talking about the source code for your program, usually all that stuff goes at the top inside commented areas:
// FirstName LastName
// ProgramName DateOr:
/*
FirstName LastName
ProgramName Date
*/But, if your talking about when your program is actually running, it depends. If you're doing a console application, then just output that stuff first:
cout << "FirstName LastName" << endl;
cout << "ProgramName Date" << endl;If you're doing a Windows application, then it would depend of what kind of application you're doing.
If I havn't answered you question yet, then I have no idea of what you're talking about - explain :)
Kevin

If you want to have your title being centered in the code as comments then use this:
// ____blank spaces YOUR NAME ______
or
/* ____blank spaces YOUR NAME ______ */but if you want your name to be printed in the center screen while your are executing your program use this:
cout << "\t\t\t your name";
\t is used as tab you can also use \5t which will place 5 tab spaces. in my example above their are 3 tabs. use as many tabs as you need to bring your name in center.
their are other solutions also which involve display and text alignment but this is the simplest one.

Okay, this is assuming that you're trying to print that stuff in a console window. First of all, only 80 characters can fit in one line of the console window. If your first and last name combined is an even number of characters, then you're in luck. If they're odd, then they will have to be offset by just one character.
Yea, the simplest way would be to just use spaces to bump the text over.
Still need help?
Kevin

if you are using the codewarrior compiler, (not sure if its in any other compiler) you can just do this:
#include
cout<< setw(5) << "my program";

#include iomanip.h
sorry bout that, heh, put the arrows there and it made the iomanip.h text dissapear in the post

![]() |
dos script
|
wat is PHP?
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |