LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bolding in C++ (https://www.linuxquestions.org/questions/programming-9/bolding-in-c-94928/)

TriggerJ 09-20-2003 03:54 PM

Bolding in C++
 
Would anyone know how I would bold the first letter of a word in C++?

Thanks,

J-

kev82 09-20-2003 04:17 PM

sorry, that doesnt really make much sense, can you rephrase or say what your actually trying to do

TriggerJ 09-20-2003 04:21 PM

I want to make the first letter of a word to be bold.

Ex: Help

kev82 09-20-2003 04:44 PM

i understood your question, the fact is it doesnt make sense, c++ deals in plain text or binary, you would have to use an external graphics library to make it output anything like that.

if you can give me a clue as to what you want like "i want to input plain text and ouput html/TeX with the first letter of each word bolded" or "i want to open up a window that displays the contents of a text file with the first letter of each word in bold" then maybe i can help but just asking "how to bold the first letter of each word" makes no sense in this context.

jinksys 09-21-2003 12:36 AM

It is possible to bold characters using the ncurses library.

coolman0stress 09-21-2003 10:11 AM

Like kev82 mentioned, you need to tell us what output format you're dealing with. Is it console, plain text (and other files), windows, html, etc?

TriggerJ 09-21-2003 10:28 AM

It's a console application. Not sure if that helps...

Jessica

shishir 09-21-2003 01:00 PM

why dont you use escape sequences for colour higlighting on terminals,

#include <iostream.h>

int main ()
{

cout<<"\033[01;37m";
cout<<"the bold text:\n";
cout<<"\033[0m";

return 0;

}


this program prints the line in white..emboldened...

hope this has been of some help...

here are some color codes you might like to use:
black 0;30
green 0;32
red 0;31
brown 0;33
dark grey 1;31
light green 1;32
light red 1;31
yellow 1;33
blue 0;34
cyan 0;36
purple 0;35
light gray 0;37
light blue 1;34
light cyan 1;36
light purple 1;35
white 1;37

TriggerJ 09-21-2003 02:17 PM

Awesome...thanks bunches.

Jessica

jinksys 09-21-2003 04:07 PM

It would be much better to implement this program using ncurses than escape sequences that may or may work with the given terminal. I will post a sample program when i get home.

shishir 09-22-2003 12:13 AM

yeah..agreed it would not work...atleast i dont think it would on VT100, but other than that ..it is working on the terminal that i use...ncurses doesnt sound like a great idea for such a small thing...


All times are GMT -5. The time now is 10:00 AM.