<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 7.7 &#8212; Default parameters</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/77-default-parameters/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-95892</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 20 Aug 2011 15:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-95892</guid>
		<description>No you can&#039;t.</description>
		<content:encoded><![CDATA[<p>No you can&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sphingine</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-95884</link>
		<dc:creator>Sphingine</dc:creator>
		<pubDate>Sat, 20 Aug 2011 06:51:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-95884</guid>
		<description>Can i give d definition as:

void printvalues(int nvalue1=0, int nvalue2=2)
{

cout&lt;&lt;&quot;1st : &quot;&lt;&lt; nvalue1&lt;&lt; endl;
cout&lt;&lt;&quot;2st : &quot;&lt;&lt; nvalue2&lt;&lt; endl;

}

and call the function as:

printvalues(,3);</description>
		<content:encoded><![CDATA[<p>Can i give d definition as:</p>
<p>void printvalues(int nvalue1=0, int nvalue2=2)<br />
{</p>
<p>cout&lt;&lt;&quot;1st : &quot;&lt;&lt; nvalue1&lt;&lt; endl;<br />
cout&lt;&lt;&quot;2st : &quot;&lt;&lt; nvalue2&lt;&lt; endl;</p>
<p>}</p>
<p>and call the function as:</p>
<p>printvalues(,3);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: otocan</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-95202</link>
		<dc:creator>otocan</dc:creator>
		<pubDate>Wed, 23 Feb 2011 10:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-95202</guid>
		<description>Hi Alex

Shouldn&#039;t all the examples of pointers to chars in this chapter e.g.

char *strValue

be instead

char *pszValue?

Cheers

Kevin</description>
		<content:encoded><![CDATA[<p>Hi Alex</p>
<p>Shouldn&#8217;t all the examples of pointers to chars in this chapter e.g.</p>
<p>char *strValue</p>
<p>be instead</p>
<p>char *pszValue?</p>
<p>Cheers</p>
<p>Kevin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dave</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-71307</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Fri, 30 Oct 2009 12:50:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-71307</guid>
		<description>I must say this site is awesome and clean looking..specially how the code is displayed....looks neat! keep up good work and i am doing last min craming when i googled default params...so wish me luck! :)</description>
		<content:encoded><![CDATA[<p>I must say this site is awesome and clean looking..specially how the code is displayed&#8230;.looks neat! keep up good work and i am doing last min craming when i googled default params&#8230;so wish me luck! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anshuman</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-71288</link>
		<dc:creator>Anshuman</dc:creator>
		<pubDate>Fri, 30 Oct 2009 07:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-71288</guid>
		<description>you must not use specify the default value both in function prototype and definition

&lt;pre&gt;
void printvalues(int nvalue1, int nvalue2)
{

cout&lt;&lt;&quot;1st : &quot;&lt;&lt; nvalue1&lt;&lt; endl;
cout&lt;&lt;&quot;2st : &quot;&lt;&lt; nvalue2&lt;&lt; endl;

}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>you must not use specify the default value both in function prototype and definition</p>
<pre>
void printvalues(int nvalue1, int nvalue2)
{

cout&lt;&lt;&quot;1st : &quot;&lt;&lt; nvalue1&lt;&lt; endl;
cout&lt;&lt;&quot;2st : &quot;&lt;&lt; nvalue2&lt;&lt; endl;

}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: simon1122</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-68970</link>
		<dc:creator>simon1122</dc:creator>
		<pubDate>Thu, 24 Sep 2009 18:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-68970</guid>
		<description>hi

can any one tell me what is wrong with this one??

thak you</description>
		<content:encoded><![CDATA[<p>hi</p>
<p>can any one tell me what is wrong with this one??</p>
<p>thak you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: simon1122</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-68969</link>
		<dc:creator>simon1122</dc:creator>
		<pubDate>Thu, 24 Sep 2009 18:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-68969</guid>
		<description>//Function
#include
 using namespace std;
 
 
  void printvalues(int nvalue1, int nvalue2=10 );
  



 int main()
 {
 
printvalues(1);
printvalues(1,3);

/*scaffolding code for testing purpose*/
 cin.ignore(256, &#039;\n&#039;);
 cout&lt;&lt; &quot;press Enter to continue..&quot; &lt;&lt; endl;
 cin.get();

return 0;
}


void printvalues(int nvalue1, int nvalue2 = 10 )
{
    
     cout&lt;&lt;&quot;1st  : &quot;&lt;&lt; nvalue1&lt;&lt; endl;
     cout&lt;&lt;&quot;2st  : &quot;&lt;&lt; nvalue2&lt;&lt; endl;
     
     }</description>
		<content:encoded><![CDATA[<p>//Function<br />
#include<br />
 using namespace std;</p>
<p>  void printvalues(int nvalue1, int nvalue2=10 );</p>
<p> int main()<br />
 {</p>
<p>printvalues(1);<br />
printvalues(1,3);</p>
<p>/*scaffolding code for testing purpose*/<br />
 cin.ignore(256, &#8216;\n&#8217;);<br />
 cout&lt;&lt; &quot;press Enter to continue..&quot; &lt;&lt; endl;<br />
 cin.get();</p>
<p>return 0;<br />
}</p>
<p>void printvalues(int nvalue1, int nvalue2 = 10 )<br />
{</p>
<p>     cout&lt;&lt;&quot;1st  : &quot;&lt;&lt; nvalue1&lt;&lt; endl;<br />
     cout&lt;&lt;&quot;2st  : &quot;&lt;&lt; nvalue2&lt;&lt; endl;</p>
<p>     }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ericc</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-68701</link>
		<dc:creator>Ericc</dc:creator>
		<pubDate>Sun, 20 Sep 2009 14:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-68701</guid>
		<description>u forgot ; in the Prototype</description>
		<content:encoded><![CDATA[<p>u forgot ; in the Prototype</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-33851</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 06 Dec 2008 19:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-33851</guid>
		<description>I just added a lesson on &lt;a href=&quot;http://www.learncpp.com/cpp-tutorial/59-random-number-generation/&quot; rel=&quot;nofollow&quot;&gt;random number generation&lt;/a&gt;. :)</description>
		<content:encoded><![CDATA[<p>I just added a lesson on <a href="http://www.learncpp.com/cpp-tutorial/59-random-number-generation/" rel="nofollow">random number generation</a>. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pathik</title>
		<link>http://www.learncpp.com/cpp-tutorial/77-default-parameters/comment-page-1/#comment-33718</link>
		<dc:creator>Pathik</dc:creator>
		<pubDate>Fri, 05 Dec 2008 00:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/77-default-parameters/#comment-33718</guid>
		<description>how do you get a random value in C++?
For example :
&lt;pre&gt;
int main()
{
	using namespace std;
	int y = 25; // I want y to be a random number below 100
	int x;
	
try_again:
	do
	{
		cout &lt;&lt; &quot;Enter a value below 100: &quot;;
		cin &gt;&gt; x;
	}while (x &gt; 100);
	
	if (x &lt; y)
	{
		cout &lt;&lt; &quot;Too small&quot; &lt;&lt; endl;
		goto try_again;
	}
	if (x &gt; y)
	{
		cout &lt;&lt; &quot;Too big&quot; &lt;&lt; endl;
		goto try_again;
	}
	if (x == y)
	{
		cout &lt;&lt; &quot;WOW!! You Got it!&quot; &lt;&lt; endl;
	}
	return 0;
}
&lt;/pre&gt;

You see, I want y to be a random number when program starts up.</description>
		<content:encoded><![CDATA[<p>how do you get a random value in C++?<br />
For example :</p>
<pre>
int main()
{
	using namespace std;
	int y = 25; // I want y to be a random number below 100
	int x;

try_again:
	do
	{
		cout &lt;&lt; &quot;Enter a value below 100: &quot;;
		cin &gt;&gt; x;
	}while (x &gt; 100);

	if (x &lt; y)
	{
		cout &lt;&lt; &quot;Too small&quot; &lt;&lt; endl;
		goto try_again;
	}
	if (x &gt; y)
	{
		cout &lt;&lt; &quot;Too big&quot; &lt;&lt; endl;
		goto try_again;
	}
	if (x == y)
	{
		cout &lt;&lt; &quot;WOW!! You Got it!&quot; &lt;&lt; endl;
	}
	return 0;
}
</pre>
<p>You see, I want y to be a random number when program starts up.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

