C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 40:
[40.2] Is there a TeX or LaTeX macro that fixes the spacing on "C++"?

Yes.

Here are two LaTeX macros for the word "C++". They prevent line breaks between the "C" and "++", and the first packs the two "+"s close to each other but the second does not. Try them both and see which one you like best.

\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +{rbrace}{rbrace}

\def\CC{lbrace}{lbrace}C\nolinebreak[4]\hspace{-.05em}\raisebox{.4ex}{\tiny\bf ++{rbrace}{rbrace}{rbrace}
Here are two more LaTeX macros for the word "C++". They allow line breaks between the "C" and "++", which may not be desirable, but they're included here just in case.
\def\CC{C\raise.22ex\hbox{lbrace}{lbrace}\footnotesize +{rbrace}{rbrace}\raise.22ex\hbox{\footnotesize +{rbrace}{rbrace}

\def\CC{lbrace}{lbrace}C\hspace{-.05em}\raisebox{.4ex}{\tiny\bf ++{rbrace}{rbrace}{rbrace}