How to write a string and see if it is an expression? : <p>I am solving now an algorithmic problem using recursion. So what you need to find out in this problem is that if the string you inputed is an expression. So for example you have string "256+300-500" - this is an expression. So an expression is a string that contains numbers and the signes "+" and "-". The signs + and - cant stay one near eachother and also there cant be to + or 2 - near eachother. So "256++300" and "256+-600-500" is not an expression. Also if the number contains a letter in it then it is not an expression "54e2". So please help me make this program. I have done the part which sees if the number string is a number.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include&lt;string&gt;
using namespace std;
int cif(char c)
{
if(isdigit(c))return 1;
else return 0;
}
int num (string s)
{
int z=s.length();
if(z==1) return cif(s[0]);
else
    {
      char c =s[0];
      s=s.substr(1);
      if(cif(c) &amp;&amp; num(s))return 1; else return 0;
    }
}
int main()
{
 cout &lt;&lt; num("2353Y3554");
 return 0;
}
</code></pre>

<p>The output of this program is 0 becase it is not a number, if it was the output would have been 1. Please help me make the program that I need continueing with this one, please.</p>
