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 ?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

itsmeandnobodyelseConnect With a Mentor Commented:
>>>> 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
On what kind of output device?
Is it a VT100 compatble display?   A HTML browswer?
emreaymanAuthor Commented:
it is win32 app.  (DOS)
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

emreaymanAuthor Commented:
cout << "WELCOME";

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

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


sorry, just trying to be funny...
emreaymanAuthor Commented:
thank you ozo and NickGeorghio :)  . ozo i added this line device=c:\windows\command\ansi.sys  in 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++)
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.