Receiving C2447 error - unable to correct error<font face=Arial size=2><font size=1> <p><font size=2>I am a new to C++ and I am completing an exercise in C++.  I have read my text and online materials to see if I can correct the error.  I have tried everything that I know to correct the problem, but no luck.</font></p> <p align=left><font size=2>I don't understand what is meant by missing function header?  This is the error details: error C2447: '{' : missing function header (old-style formal list?) which occurs a line 60 (the red bracket below).  </font></p> <p align=left><font size=2></font> </p> <p align=left><font size=2>Any guidance is helpful.</font></p> <p align=left><font size=2>Chris   </font></p> <p align=left><img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFCLVvZNcnIJT9x2uZNvyuIGWah9F3g0vyQYx7NayjHus1&amp;t=633263991144971555"></p> <p align=left> </p><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&quot;stdafx.h&quot;</p></font><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&lt;iostream&gt;</p></font><font color="#0000ff" size=2> <p>using</font><font size=2> </font><font color="#0000ff" size=2>namespace</font><font size=2> std;</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k); </font><font color="#008000" size=2>// function prototype </p></font><font color="#0000ff" size=2> <p>int</font><font size=2> _tmain(</font><font color="#0000ff" size=2>int</font><font size=2> argc, _TCHAR* argv[])</p> <p>{ </p> <p></font><font color="#0000ff" size=2>int</font><font size=2> n, k ; </font><font color="#008000" size=2>// parameters for the binomial number </p></font><font size=2> <p></font><font color="#0000ff" size=2>int</font><font size=2> result ;</p> <p>cout &lt;&lt; endl ; </p> <p></font><font color="#008000" size=2>// read in n &amp; k </p></font><font size=2> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter n (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; n ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter k (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; k ;</p> <p>result = binomial(n, k) ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Binomial number &quot;</font><font size=2> &lt;&lt; n &lt;&lt; </font><font color="#a31515" size=2>&quot;C&quot;</font><font size=2> &lt;&lt; k </p> <p>&lt;&lt; </font><font color="#a31515" size=2>&quot; = &quot;</font><font size=2> &lt;&lt; result &lt;&lt; endl ;</p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (0) ;</p> <p>}</p></font><font color="#008000" size=2> <p>// ********************************************************</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k ) ;</p></font><font color="#008000" size=2> <p>/* Computes the binomial coefficient nCk */</p> <p>/* */</p> <p>/* Inputs: */</p> <p>/* n, k (integers) */</p> <p>/* */</p> <p>/* Output: */</p> <p>/* binomial coefficient nCk (integer) */</p></font><font size=2> <p><font color="#ff0000">{</font></p> <p></font><font color="#0000ff" size=2>int</font><font size=2> numerator, denominator ;</p> <p></font><font color="#0000ff" size=2>int</font><font size=2> i ; </font><font color="#008000" size=2>// needed to compute numerator &amp; denominator &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k) </p> <p>{</p> <p></font><font color="#0000ff" size=2>return</font><font size=2>(0) ;</p> <p>}</p> <p></font><font color="#0000ff" size=2>else</font><font size=2> </p> <p>{</p> <p>denominator = 1 ; </font><font color="#008000" size=2>// initial value &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>for</font><font size=2> (i = 1 ; i &lt;= k ; i = i+1)</p> <p>denominator = denominator * 1 ; &lt;![endif]&gt;</p> <p></font><font color="#0000ff" size=2>for</font><font size=2> (i = n-k+1 ; i &lt;= n ; i = i+1)</p> <p>numerator = numerator * i ; &lt;![endif]&gt; </p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (numerator/denominator) ;</p> <p>} </font><font color="#008000" size=2>// else</p></font><font size=2> <p>} </p></font></font></font>© 2009 Microsoft Corporation. All rights reserved.Thu, 19 Jun 2008 00:15:52 Z3b892743-b94e-407e-ad7e-83f1a674f757http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#3b892743-b94e-407e-ad7e-83f1a674f757http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#3b892743-b94e-407e-ad7e-83f1a674f757New to C__http://social.msdn.microsoft.com/Profile/ja-JP/?user=New%20to%20C__Receiving C2447 error - unable to correct error<font face=Arial size=2><font size=1> <p><font size=2>I am a new to C++ and I am completing an exercise in C++.  I have read my text and online materials to see if I can correct the error.  I have tried everything that I know to correct the problem, but no luck.</font></p> <p align=left><font size=2>I don't understand what is meant by missing function header?  This is the error details: error C2447: '{' : missing function header (old-style formal list?) which occurs a line 60 (the red bracket below).  </font></p> <p align=left><font size=2></font> </p> <p align=left><font size=2>Any guidance is helpful.</font></p> <p align=left><font size=2>Chris   </font></p> <p align=left><img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFCLVvZNcnIJT9x2uZNvyuIGWah9F3g0vyQYx7NayjHus1&amp;t=633263991144971555"></p> <p align=left> </p><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&quot;stdafx.h&quot;</p></font><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&lt;iostream&gt;</p></font><font color="#0000ff" size=2> <p>using</font><font size=2> </font><font color="#0000ff" size=2>namespace</font><font size=2> std;</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k); </font><font color="#008000" size=2>// function prototype </p></font><font color="#0000ff" size=2> <p>int</font><font size=2> _tmain(</font><font color="#0000ff" size=2>int</font><font size=2> argc, _TCHAR* argv[])</p> <p>{ </p> <p></font><font color="#0000ff" size=2>int</font><font size=2> n, k ; </font><font color="#008000" size=2>// parameters for the binomial number </p></font><font size=2> <p></font><font color="#0000ff" size=2>int</font><font size=2> result ;</p> <p>cout &lt;&lt; endl ; </p> <p></font><font color="#008000" size=2>// read in n &amp; k </p></font><font size=2> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter n (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; n ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter k (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; k ;</p> <p>result = binomial(n, k) ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Binomial number &quot;</font><font size=2> &lt;&lt; n &lt;&lt; </font><font color="#a31515" size=2>&quot;C&quot;</font><font size=2> &lt;&lt; k </p> <p>&lt;&lt; </font><font color="#a31515" size=2>&quot; = &quot;</font><font size=2> &lt;&lt; result &lt;&lt; endl ;</p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (0) ;</p> <p>}</p></font><font color="#008000" size=2> <p>// ********************************************************</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k ) ;</p></font><font color="#008000" size=2> <p>/* Computes the binomial coefficient nCk */</p> <p>/* */</p> <p>/* Inputs: */</p> <p>/* n, k (integers) */</p> <p>/* */</p> <p>/* Output: */</p> <p>/* binomial coefficient nCk (integer) */</p></font><font size=2> <p><font color="#ff0000">{</font></p> <p></font><font color="#0000ff" size=2>int</font><font size=2> numerator, denominator ;</p> <p></font><font color="#0000ff" size=2>int</font><font size=2> i ; </font><font color="#008000" size=2>// needed to compute numerator &amp; denominator &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k) </p> <p>{</p> <p></font><font color="#0000ff" size=2>return</font><font size=2>(0) ;</p> <p>}</p> <p></font><font color="#0000ff" size=2>else</font><font size=2> </p> <p>{</p> <p>denominator = 1 ; </font><font color="#008000" size=2>// initial value &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>for</font><font size=2> (i = 1 ; i &lt;= k ; i = i+1)</p> <p>denominator = denominator * 1 ; &lt;![endif]&gt;</p> <p></font><font color="#0000ff" size=2>for</font><font size=2> (i = n-k+1 ; i &lt;= n ; i = i+1)</p> <p>numerator = numerator * i ; &lt;![endif]&gt; </p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (numerator/denominator) ;</p> <p>} </font><font color="#008000" size=2>// else</p></font><font size=2> <p>} </p></font></font></font>Sun, 02 Dec 2007 01:38:16 Z2007-12-06T11:16:04Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#89833af5-4308-459b-8584-e6e0736c1c58http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#89833af5-4308-459b-8584-e6e0736c1c58Andreas Masurhttp://social.msdn.microsoft.com/Profile/ja-JP/?user=Andreas%20MasurReceiving C2447 error - unable to correct error<div><span class=Apple-style-span style="white-space:normal">Simply remove the ';' sign at the end of your definition for 'binomial'...<br class=webkit-block-placeholder></span></div> <div><span class=Apple-style-span style="white-space:normal"><br class=webkit-block-placeholder></span></div> <div><span class=Apple-style-span style="color:rgb(0,128,0);white-space:normal">// ********************************************************</span><br></div><font face=Arial size=2><font size=1><font color="#0000ff" size=2></font> <p><font color="#0000ff" size=2>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k ) ;                              <span class=Apple-style-span style="color:rgb(255,0,0)"><span class=Apple-style-span style="font-weight:bold">&lt;-- Remove the ';' right here</span></span></font></p><font size=2></font><font color="#008000" size=2> <p>/* Computes the binomial coefficient nCk */</p> <p>/* */</p> <p>/* Inputs: */</p> <p>/* n, k (integers) */</p> <p>/* */</p> <p>/* Output: */</p> <p>/* binomial coefficient nCk (integer) */</p></font><font size=2> <p><font color="#ff0000">{</font></p></font> <p><font color="#0000ff" size=2>int</font><font size=2> numerator, denominator ;</font></p><font size=2></font> <p><font color="#0000ff" size=2>int</font><font size=2> i ; </font><font color="#008000" size=2>// needed to compute numerator &amp; denominator &lt;![endif]&gt;</font></p><font color="#008000" size=2></font><font size=2></font> <p><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k) </font></p><font size=2> <p>{</p></font> <p><font color="#0000ff" size=2>return</font><font size=2>(0) ;</font></p><font size=2> <p>}</p></font> <p><font color="#0000ff" size=2>else</font><font size=2> </font></p><font size=2> <p>{</p></font> <p><font size=2>denominator = 1 ; </font><font color="#008000" size=2>// initial value &lt;![endif]&gt;</font></p><font color="#008000" size=2></font><font size=2></font> <p><font color="#0000ff" size=2>for</font><font size=2> (i = 1 ; i &lt;= k ; i = i+1)</font></p><font size=2> <p>denominator = denominator * 1 ; &lt;![endif]&gt;</p></font> <p><font color="#0000ff" size=2>for</font><font size=2> (i = n-k+1 ; i &lt;= n ; i = i+1)</font></p><font size=2> <p>numerator = numerator * i ; &lt;![endif]&gt; </p></font> <p><font color="#0000ff" size=2>return</font><font size=2> (numerator/denominator) ;</font></p><font size=2></font> <p><font size=2>} </font><font color="#008000" size=2>// else</font></p><font color="#008000" size=2></font><font size=2> <p>} </p></font></font></font><br>Sun, 02 Dec 2007 01:48:21 Z2007-12-06T11:15:21Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#130b241a-26ed-4802-8089-052747a1c4afhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#130b241a-26ed-4802-8089-052747a1c4afNew to C__http://social.msdn.microsoft.com/Profile/ja-JP/?user=New%20to%20C__Receiving C2447 error - unable to correct error<p align=left><font face=Arial size=2>Thanks for the reply, but now I have additional errors regarding missing ';&quot; before &lt;</font></p> <p align=left><span id="_ctl0_MainContent__ctl0_PostForm_ReplyBody"></p> <div><span class=Apple-style-span style="white-space:normal">Simply remove the ';' sign at the end of your definition for 'binomial'...<br class=webkit-block-placeholder></span></div> <div><span class=Apple-style-span style="white-space:normal"><br class=webkit-block-placeholder></span></div> <div><span class=Apple-style-span style="color:rgb(0,128,0);white-space:normal">// ********************************************************</span><br></div><font face=Arial size=2><font size=1><font color="#0000ff" size=2></font> <p><font color="#0000ff" size=2>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k ) ;                              <span class=Apple-style-span style="color:rgb(255,0,0)"><span class=Apple-style-span style="font-weight:bold">&lt;-- Remove the ';' right here</span></span></font></p><font size=2></font><font color="#008000" size=2> <p>/* Computes the binomial coefficient nCk */</p> <p>/* */</p> <p>/* Inputs: */</p> <p>/* n, k (integers) */</p> <p>/* */</p> <p>/* Output: */</p> <p>/* binomial coefficient nCk (integer) */</p></font><font size=2> <p><font color="#ff0000">{</font></p></font> <p><font color="#0000ff" size=2>int</font><font size=2> numerator, denominator ;</font></p><font size=2></font> <p><font color="#0000ff" size=2>int</font><font size=2> i ; </font><font color="#008000" size=2>// needed to compute numerator &amp; denominator &lt;![endif]&gt;</font></p><font color="#008000" size=2></font><font size=2></font> <p><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k) </font></p><font size=2> <p>{</p></font> <p><font color="#0000ff" size=2>return</font><font size=2>(0) ;</font></p><font size=2> <p>}</p></font> <p><font color="#0000ff" size=2>else</font><font size=2> </font></p><font size=2> <p>{</p></font> <p><font size=2>denominator = 1 ; </font><font color="#008000" size=2>// initial value &lt;![endif]&gt;</font></p><font color="#008000" size=2></font><font size=2></font> <p><font color="#0000ff" size=2>for</font><font size=2> (i = 1 ; i &lt;= k ; i = i+1)</font></p><font size=2> <p>denominator = denominator * 1 ; &lt;![endif]&gt;</p></font> <p><font color="#0000ff" size=2>for</font><font size=2> (i = n-k+1 ; i &lt;= n ; i = i+1)</font></p><font size=2> <p>numerator = numerator * i ; &lt;![endif]&gt; </p></font> <p><font color="#0000ff" size=2>return</font><font size=2> (numerator/denominator) ;</font></p><font size=2></font> <p><font size=2>} </font><font color="#008000" size=2>// else</font></p><font color="#008000" size=2></font><font size=2> <p>} </p></font></font></font></span> <p align=left> </p> <p align=left> </p>Sun, 02 Dec 2007 01:58:16 Z2007-12-02T01:58:16Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#6ed0a870-d746-4f1c-ae80-39083d6bcf5chttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#6ed0a870-d746-4f1c-ae80-39083d6bcf5cAndreas Masurhttp://social.msdn.microsoft.com/Profile/ja-JP/?user=Andreas%20MasurReceiving C2447 error - unable to correct error<div class=quote> <table width="85%"> <tbody> <tr> <td class=txt4> <strong>C++ Student wrote:</strong></td></tr> <tr> <td class=quoteTable> <table width="100%"> <tbody> <tr> <td class=txt4 valign=top width="100%"> <p align=left><font face=Arial size=2>Thanks for the reply, but now I have additional errors. </font></p></td></tr></tbody></table></td></tr></tbody></table></div> <div><span class=Apple-style-span style="white-space:normal"><br class=webkit-block-placeholder></span></div> <div><span class=Apple-style-span style="white-space:normal">Well...and the errors are? The removal only fixes the error you posted about before. Certainly any other error in your code following this ';' sign is still there and raises not error since the first one is fixed... <img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxF2-06wONxYyCMHQHpN9O-mbTC54LHcVvUdD2XWTDiuYY1&amp;amp;t=633263991144971555"></span></div>Sun, 02 Dec 2007 02:06:24 Z2007-12-02T02:06:24Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#8804f8c1-812c-49ef-a1bc-e6c2b137e959http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#8804f8c1-812c-49ef-a1bc-e6c2b137e959New to C__http://social.msdn.microsoft.com/Profile/ja-JP/?user=New%20to%20C__Receiving C2447 error - unable to correct error<p align=left><font face=Arial size=3>I reviewed the error codes with the online help.  Tried to correct the errors, but with no success.</font></p><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&quot;stdafx.h&quot;</p></font><font color="#0000ff" size=2> <p>#include</font><font size=2> </font><font color="#a31515" size=2>&lt;iostream&gt;</p></font><font color="#0000ff" size=2> <p>using</font><font size=2> </font><font color="#0000ff" size=2>namespace</font><font size=2> std;</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k) ; </font><font color="#008000" size=2>// function prototype </p></font><font color="#0000ff" size=2> <p>int</font><font size=2> _tmain(</font><font color="#0000ff" size=2>int</font><font size=2> argc, _TCHAR* argv[])</p> <p>{ </p> <p></font><font color="#0000ff" size=2>int</font><font size=2> n, k ; </font><font color="#008000" size=2>// parameters for the binomial number </p></font><font size=2> <p></font><font color="#0000ff" size=2>int</font><font size=2> result ;</p> <p>cout &lt;&lt; endl ; </p> <p></font><font color="#008000" size=2>// read in n &amp; k </p></font><font size=2> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter n (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; n ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Enter k (positive integer) : &quot;</font><font size=2> ;</p> <p>cin &gt;&gt; k ;</p> <p>result = binomial(n, k) ; </p> <p>cout &lt;&lt; </font><font color="#a31515" size=2>&quot;Binomial number &quot;</font><font size=2> &lt;&lt; n &lt;&lt; </font><font color="#a31515" size=2>&quot;C&quot;</font><font size=2> &lt;&lt; k </p> <p>&lt;&lt; </font><font color="#a31515" size=2>&quot; = &quot;</font><font size=2> &lt;&lt; result &lt;&lt; endl ;</p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (0) ;</p> <p>}</p></font><font color="#008000" size=2> <p>// ********************************************************//</p></font><font color="#0000ff" size=2> <p>int</font><font size=2> binomial ( </font><font color="#0000ff" size=2>int</font><font size=2> n, </font><font color="#0000ff" size=2>int</font><font size=2> k )</p></font><font color="#008000" size=2> <p>/* Computes the binomial coefficient nCk */</p> <p>/* */</p> <p>/* Inputs: */</p> <p>/* n, k (integers) */</p> <p>/* */</p> <p>/* Output: */</p> <p>/* binomial coefficient nCk (integer) */</p></font><font size=2> <p>{</p> <p></font><font color="#0000ff" size=2>int</font><font size=2> numerator, denominator ;</p> <p></font><font color="#0000ff" size=2>int</font><font size=2> i ; </font><font color="#008000" size=2>// needed to compute numerator &amp; denominator &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k) </p> <p>{</p> <p></font><font color="#0000ff" size=2>return</font><font size=2>(0) ;</p> <p>}</p> <p></font><font color="#0000ff" size=2>else</font><font size=2> </p> <p>{</p> <p>denominator = 1 ; </font><font color="#008000" size=2>// initial value &lt;![endif]&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>for</font><font size=2> ( i = 1 ; i &lt;= k ; i = i + 1)</p> <p>denominator = denominator * i;&lt;![endif]&gt;</p> <p></font><font color="#0000ff" size=2>for</font><font size=2> (i = n-k+1 ; i &lt;= n ; i = i + 1) </font><font color="#008000" size=2><font color="#ff0000">//line 76.  Four errors:  </font><font size=1><font color="#ff0000">warning C4552: '&lt;=' : operator has no effect; expected operator with side-effect; </font><font size=1></p> <p><font color="#ff0000">error C2143: syntax error : missing ';' before ')';  </font><font size=1><font color="#ff0000">error C2143: syntax error : missing ';' before ')';  <font size=1>error C2143: syntax error : missing ';' before '&lt;'<img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFAL9T9LN8WIWIcruN7zjfywlHQYIkPzHn5pbVs-MEQgc1&amp;t=633263991144971555"></p></font></font> <p></font></font></font></font><font size=2>numerator = numerator * i;&lt;![endif]&gt; </p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (numerator/denominator);</p> <p>} </font><font color="#008000" size=2>// else</p></font><font size=2> <p>} </p> <p align=left> </p> <p>Thanks,</p> <p align=left>Chris</font></p>Sun, 02 Dec 2007 17:07:52 Z2007-12-02T17:07:52Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#65c1d0b5-f1d4-4ea3-b27b-491829e04bdfhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#65c1d0b5-f1d4-4ea3-b27b-491829e04bdfAndreas Masurhttp://social.msdn.microsoft.com/Profile/ja-JP/?user=Andreas%20MasurReceiving C2447 error - unable to correct error<div><span class=Apple-style-span style="white-space:normal">Well...you have some '&lt;![endif]&gt;' clauses in your code that the compiler certainly cannot understand. Please find below a cleaned-up version of your function:</span></div> <div><span class=Apple-style-span style="white-space:normal"><br class=webkit-block-placeholder></span></div> <div style="text-align:left"><span class=Apple-style-span style="white-space:normal"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Block</span></div> <p>int binomial( int n, int k )</p> <p>{</p> <p>  int numerator, denominator;</p> <p>  int i;</p> <p><br></p> <p>  int(n &lt; k)</p> <p>  {</p> <p>    return (0);</p> <p>  }</p> <p>  else</p> <p>  {</p> <p>    denominator = 1;</p> <p>    for( i = 1; i &lt;= k; i = i + 1)</p> <p>      denominator = denominator * i;</p> <p><br></p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px">    for( i = n-k+1; i &lt;= n; i = i + 1)</p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px">      numerator = numerator * i;</p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px"><br class=webkit-block-placeholder></p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px">    return (numerator/denominator);</p> <p>  }</p> <p>}</p></div></div></span></div> <div style="text-align:left"><br></div>Sun, 02 Dec 2007 17:47:19 Z2007-12-06T11:15:50Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#adb78db9-e436-4807-8552-defb6c14f8f5http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#adb78db9-e436-4807-8552-defb6c14f8f5New to C__http://social.msdn.microsoft.com/Profile/ja-JP/?user=New%20to%20C__Receiving C2447 error - unable to correct error<p align=left><font face=Arial size=2>Yes, the &lt;![endif]&gt; clauses were the problem.  The code ran when the &lt;![endif]&gt; clauses were removed.</font></p> <p align=left> </p> <p align=left>A good lesson learned.</p> <p align=left> </p> <p align=left>Thanks very much!</p> <p align=left> </p> <p align=left>Chris<img src="http://forums.microsoft.com/MSDN/WebResource.axd?d=NySzF1eivP_rMoc50GQJzcvS4MHMOEKwYrCIgDtzuzlw7GsNki3H_INlfYaLgkxFCLVvZNcnIJT9x2uZNvyuIGWah9F3g0vyQYx7NayjHus1&amp;t=633263991144971555"></p>Sun, 02 Dec 2007 21:44:08 Z2007-12-02T21:44:08Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#5ed6273e-ee33-46bc-baa2-b759741dc7e4http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#5ed6273e-ee33-46bc-baa2-b759741dc7e4Pintu Shuklahttp://social.msdn.microsoft.com/Profile/ja-JP/?user=Pintu%20ShuklaReceiving C2447 error - unable to correct errorHello Andreas ,<br>This code contain few error .have a look on the bold Line<br><br> <div class=quote> <table width="85%"> <tbody> <tr> <td class=txt4> <strong>Andreas Masur wrote:</strong></td></tr> <tr> <td class=quoteTable> <table width="100%"> <tbody> <tr> <td class=txt4 valign=top width="100%"> <div><span class=Apple-style-span style="white-space:normal">Well...you have some '&lt;![endif]&gt;' clauses in your code that the compiler certainly cannot understand. Please find below a cleaned-up version of your function:</span></div> <div><span class=Apple-style-span style="white-space:normal"><br class=webkit-block-placeholder></span></div> <div style="text-align:left"><span class=Apple-style-span style="white-space:normal"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Block</span></div> <p>int binomial( int n, int k )</p> <p>{</p> <p>  int numerator, denominator;</p> <p>  int i;</p> <p><br></p> <p>  <span style="font-weight:bold">int(n &lt; k) </span><span style="color:rgb(0,0,255)">// i think it is if(n&lt;k) instead of int</span><span style="font-weight:bold"><br></span></p> <p>  {</p> <p>    return (0);</p> <p>  }</p> <p>  else</p> <p>  {</p> <p>    denominator = 1;</p> <p>    for( i = 1; i &lt;= k; i = i + 1)</p> <p>      denominator = denominator * i;</p> <p><br></p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px">    for( i = n-k+1; i &lt;= n; i = i + 1)</p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px"><span style="font-weight:bold">      numerator = numerator * i; </span>//<span style="color:rgb(0,0,255)"> Unexpected result .Because </span><span class=Apple-style-span style="white-space:normal"><span style="color:rgb(0,0,255)">numerator is not initialized</span><br></span></p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px"><br class=webkit-block-placeholder></p> <p style="padding-right:0px;padding-left:0px;padding-bottom:1px;margin:0px 0px 1px;padding-top:0px">    return (numerator/denominator);</p> <p>  }</p> <p>}</p></div></div></span></div> <div style="text-align:left"><br></div></td></tr></tbody></table></td></tr></tbody></table></div>Mon, 03 Dec 2007 09:55:07 Z2007-12-06T11:16:04Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#ac17794e-9715-41b5-92aa-6927192e24aehttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#ac17794e-9715-41b5-92aa-6927192e24aeVoltronxhttp://social.msdn.microsoft.com/Profile/ja-JP/?user=VoltronxReceiving C2447 error - unable to correct error<p align=left><font face=Arial size=2></font> </p> <p>I would like to add an error message similar to the one below that would stop the program and recall the function if the problem would result in an overflow error.  </p> <p align=left> </p><font color="#0000ff" size=2> <p>if</font><font size=2> (n &lt; k)</p> <p>{</p> <p>cout &lt;&lt;</font><font color="#800000" size=2>&quot;ERROR!! n must be larger than k.&quot;</font><font size=2>&lt;&lt;endl ;</p> <p></font><font color="#0000ff" size=2>return</font><font size=2> (0) ;</p> <p>}</p> <p> </p>Your input would be greatly appreciated.</font>Sat, 08 Dec 2007 04:22:49 Z2007-12-08T04:22:49Zhttp://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#72a237c6-eb0f-4814-86e8-60207df9c3c0http://social.msdn.microsoft.com/Forums/ja-JP/vclanguage/thread/3b892743-b94e-407e-ad7e-83f1a674f757#72a237c6-eb0f-4814-86e8-60207df9c3c0Pintu Shuklahttp://social.msdn.microsoft.com/Profile/ja-JP/?user=Pintu%20ShuklaReceiving C2447 error - unable to correct error<font size=2><span style="font-family:Courier"> <div class=quote> <table width="85%"> <tbody> <tr> <td class=txt4> <strong>Voltronx wrote:</strong></td></tr> <tr> <td class=quoteTable> <table width="100%"> <tbody> <tr> <td class=txt4 valign=top width="100%"></span></font> <p style="font-family:Courier" align=left><font size=2> </font></p> <p style="font-family:Courier"><font size=2>I would like to add an error message similar to the one below that would stop the program and recall the function if the problem would result in an overflow error.  </font></p> <p style="font-family:Courier" align=left><font size=2> </font></p><font style="font-family:Courier" color="#0000ff" size=2></font> <p style="font-family:Courier"><font color="#0000ff" size=2>if</font><font size=2> (n &lt; k)</font></p> <p style="font-family:Courier"><font size=2>{</font></p> <p style="font-family:Courier"><font size=2>cout &lt;&lt;</font><font color="#800000" size=2>&quot;ERROR!! n must be larger than k.&quot;</font><font size=2>&lt;&lt;endl ;</font></p> <p style="font-family:Courier"><font color="#0000ff" size=2>return</font><font size=2> (0) ;</font></p> <p style="font-family:Courier"><font size=2>}</font></p> <p style="font-family:Courier"><font size=2> </font></p><font style="font-family:Courier" size=2>Your input would be greatly appreciated.</font><font size=2><span style="font-family:Courier"></span></font></td></tr></tbody></table></td></tr></tbody></table></div></span><br style="font-family:Courier"><br style="font-family:Courier"><span style="font-family:Courier">Hello Voltronx this will defenately show you the message but but will not recall the function .if you want that your program will work according to your logic .then you should use a do..while loop inside your program like shown in the following example</span><br style="font-family:Courier"><br style="font-family:Courier"></font> <div style="font-family:Courier;text-align:left"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><font size=2><span style="width:100%">Code Block</span></font></div> <p><font size=2>do{</font></p> <p><font size=2>//write your code here<br></font></p> <p><font size=2>}while(n&lt;k);<br></font></p></div></div><font size=2><br><br>Thanx<br></font></div>Sat, 08 Dec 2007 12:18:41 Z2007-12-08T12:18:41Z