Computing.Net > Forums > Programming > C++ Title appear in program

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ Title appear in program

Reply to Message Icon

Name: key
Date: December 4, 2002 at 08:07:54 Pacific
OS: w2k
CPU/Ram: 512
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: kev
Date: December 4, 2002 at 09:06:19 Pacific
Reply:

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 Date

Or:

/*
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


0

Response Number 2
Name: Key
Date: December 4, 2002 at 13:07:17 Pacific
Reply:

How would I justify the text, format display in the center of the program center


0

Response Number 3
Name: Clicker
Date: December 4, 2002 at 14:45:53 Pacific
Reply:

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.


0

Response Number 4
Name: kev
Date: December 4, 2002 at 16:01:30 Pacific
Reply:

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



0

Response Number 5
Name: billdozor
Date: December 4, 2002 at 19:52:54 Pacific
Reply:

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";


0

Related Posts

See More



Response Number 6
Name: billdozor
Date: December 4, 2002 at 19:54:29 Pacific
Reply:

#include iomanip.h

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

dos script wat is PHP?



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ Title appear in program

jobs in programing? www.computing.net/answers/programming/jobs-in-programing/8125.html

copy text to clipboard with c/c++ www.computing.net/answers/programming/copy-text-to-clipboard-with-cc/11940.html

How can I grap c all text in every single lin www.computing.net/answers/programming/how-can-i-grap-c-all-text-in-every-single-lin/19692.html