how to write underlined text in c++?

Hello i want to write a underlined heading at the begining of the program . How can i do that ?
emreaymanAsked:
Who is Participating?
 
itsmeandnobodyelseCommented:
>>>> Is there a another simple method (I'm writing my program in Visual C++)

The problem is not in C++ but in the console. A console output cannot be underlined beside you would find a console font where each character already includes a '_' (visually).

What you can do in a Win32 console is to write text in different colors. Maybe you can substitute the underlining by using an appropriate coloring. To see the possibilities you should load the CONSOLE sample from MSDN_LIB. You'll find a link to that sample in MSDN by the title 'Console sample (console functions)' .

Regards, Alex
0
 
ozoCommented:
On what kind of output device?
Is it a VT100 compatble display?   A HTML browswer?
0
 
emreaymanAuthor Commented:
it is win32 app.  (DOS)
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
emreaymanAuthor Commented:
cout << "WELCOME";

how can i write this underlined.
0
 
ozoCommented:
If you load
device=c:\windows\command\ansi.sys
in your CONFIG.SYS file, then you should be able to
cout << "\033[4mWELCOME\033[0m";
0
 
emreaymanAuthor Commented:
Is there another way ?.it's a console application .
0
 
NickGeorghiouCommented:

cout << "WELCOME" << endl;
cout << "------------" << endl;

:-)

sorry, just trying to be funny...
0
 
emreaymanAuthor Commented:
thank you ozo and NickGeorghio :)  . ozo i added this line device=c:\windows\command\ansi.sys  in command.com and tried with your code but it didn't work . Let's say it works If i run it under another computer that ansi.sys not loaded it's not going to show text underlined right? . Is there a another simple method (I'm writing my program in Visual C++)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.