Search code examples
htmlincludepre

<pre> not working well with <iostream> for C++ Code


I want to show the text below

#include <algorithm>
#include <iostream>

in my HTML file. I know that we have to use the HTML pre tag, but when I do so, I can only see #include.

In fact, I am not able to include the code on Stack Overflow; it is showing me only #include.

Please help me.


Solution

  • You have to replace < and > (HTML reserved characters), with their respective HTML entities : &lt; and &gt; :

    <pre>
      #include &lt;algorithm&gt;
      #include &lt;iostream&gt;
    </pre>