Ignoring a line beginning with a '#' in command prompt
<p>I am writing a code which requires me to ignore comment lines (i.e, lines beginning with a # sign) till the end of the line. I'm using linux to code in c++. For e.g: in case of adding two numbers.</p>

<pre><code>xxx@ubuntu:~ $ ./add
Enter the two numbers to be added
1 #this is the first number
2 #this is the second number
result: 3
</code></pre>

<p>So the comment line can be anywhere. It just has to ignore the entire line and take the next value as input.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
int main()
{
int a,b;


cout&lt;&lt; "Enter the two numbers to be added:\n";
while(cin &gt;&gt;a &gt;&gt;b)
{
if (a == '#'|| b == '#')
continue;
cout &lt;&lt; "Result: "&lt;&lt;a+b;
}
return 0;
}
</code></pre>
