<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>electrofriends.com &#187; Advanced programs</title>
	<atom:link href="http://electrofriends.com/category/source-codes/software-programs/cpp-programs/cpp-advanced-programs/feed/" rel="self" type="application/rss+xml" />
	<link>http://electrofriends.com</link>
	<description>...bringing innovative minds together</description>
	<lastBuildDate>Fri, 30 Apr 2010 05:54:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>C++ program using class to generate mark sheet using multiple inheritance</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-generate-mark-sheet-using-multiple-inheritance/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-generate-mark-sheet-using-multiple-inheritance/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 15:17:28 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[inheritances]]></category>
		<category><![CDATA[multiple inheritances]]></category>
		<category><![CDATA[student class]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1144</guid>
		<description><![CDATA[Using multiple inheritances, prepare a Student Mark sheet, class marks for every student in three subjects. The inherited class generates mark sheet. #include&#60;iostream.h&#62; #include&#60;stdio.h&#62; #include&#60;dos.h&#62; class student &#123; int roll; char name&#91;25&#93;; char add &#91;25&#93;; char *city; public: student&#40;&#41; &#123; cout&#60;&#60;&#34;welcome in the student information system&#34;&#60;&#60;endl; &#125; void getdata&#40;&#41; &#123; cout&#60;&#60;&#34;\n enter the student roll [...]]]></description>
			<content:encoded><![CDATA[<p>Using multiple inheritances, prepare a Student Mark sheet, class marks for every student in three subjects. The inherited class generates mark sheet.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;stdio.h&gt;</span>
<span style="color: #339900;">#include&lt;dos.h&gt;</span>
<span style="color: #0000ff;">class</span> student 
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> roll<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">char</span> name<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">25</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">char</span> add <span style="color: #008000;">&#91;</span><span style="color: #0000dd;">25</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>city<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span> student<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;welcome in the student information system&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the student roll no.&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>roll<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the student name&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>name<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>\n enter ther student address<span style="color: #FF0000;">&quot;;
		cin&gt;&gt;add;
		cout&lt;&lt;&quot;</span>\n enter the student city<span style="color: #FF0000;">&quot;;
		cin&gt;&gt;city;
	}
	void putdata()
	{
		cout&lt;,&quot;</span>\n the student roll no<span style="color: #008080;">:</span><span style="color: #FF0000;">&quot;&lt;&lt;roll;
		cout&lt;&lt;&quot;</span>\n the student name<span style="color: #008080;">:</span><span style="color: #FF0000;">&quot;&lt;&lt;name;
		cout&lt;&lt;&quot;</span>\n the student coty<span style="color: #008080;">:</span><span style="color: #FF0000;">&quot;&lt;&lt;city;
	}
};
class mrks: public student
{
	int sub1;
	int sub2;
	int sub3;
	int per;
	public: void input()
	{
		getdata();
		cout&lt;&lt;&quot;</span>\n enter the marks1<span style="color: #008080;">:</span><span style="color: #FF0000;">&quot;
		cin&gt;&gt;sub1:
		cout&lt;&lt;&quot;</span>\n enter the marks2<span style="color: #008080;">:</span><span style="color: #FF0000;">&quot;;
		cin&gt;&gt;sub2;
		cout&lt;&lt;<span style="color: #000099; font-weight: bold;">\n</span> enter the marks3:&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>sub3<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> output<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		putdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> marks1:&quot;</span><span style="color: #000080;">&lt;&lt;</span>sub1<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> marks2:&quot;</span><span style="color: #000080;">&lt;&lt;</span>sub2<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> marks3:&quot;</span><span style="color: #000080;">&lt;&lt;</span>sub3<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> calculate <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		per<span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>sub1<span style="color: #000040;">+</span>sub2<span style="color: #000040;">+</span>sub3<span style="color: #008000;">&#41;</span><span style="color: #000040;">/</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> tottal percentage&quot;</span><span style="color: #000080;">&lt;&lt;</span>per<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	marks m1<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">25</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> ch<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> count<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">do</span> 
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>\n1.<span style="color: #007788;">input</span> data<span style="color: #FF0000;">&quot;;
		cout&lt;&lt;<span style="color: #000099; font-weight: bold;">\n</span>2.output data&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>\n3. <span style="color: #007788;">Calculate</span> percentage<span style="color: #FF0000;">&quot;;
		cout&lt;&lt;<span style="color: #000099; font-weight: bold;">\n</span>4.exit&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>\n enter the choice<span style="color: #FF0000;">&quot;;
		cin&gt;&gt;ch;
		switch (ch)
		{
			case 1:
			m1.input();
			count++;
			break;
&nbsp;
                        case2:
			m1.output();
			break;
&nbsp;
			case3:
			m1.calculate();
			break;
		}
	} while (ch!=4);
}</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-generate-mark-sheet-using-multiple-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ class program to perform complex arithmetic using operator overloading</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 14:04:26 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[add complex numbers]]></category>
		<category><![CDATA[c++ complex]]></category>
		<category><![CDATA[complex arithmetic]]></category>
		<category><![CDATA[complex numbers]]></category>
		<category><![CDATA[operator overloading]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1142</guid>
		<description><![CDATA[Write a program to perform complex arithmetic using operator overloading #include&#60;iostream.h&#62; #include&#60;stdio.h&#62; #include&#60;conio.h&#62; #include&#60;process.h&#62; class complex &#123; int real; float image; public: void getdata&#40;&#41; &#123; cout&#60;&#60;&#34;\n enter the real part of the complex&#34;; cin&#62;&#62;real; cout&#60;&#60;&#34;\n enter the imaginary part of the complex&#34;; cin&#62;&#62;image; &#125; void operator + &#40;complex&#41;; void operator - &#40;complex&#41;; &#125;; &#160; void [...]]]></description>
			<content:encoded><![CDATA[<p>Write a program to perform complex arithmetic using operator overloading</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;stdio.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
<span style="color: #339900;">#include&lt;process.h&gt;</span>
<span style="color: #0000ff;">class</span> complex
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> real<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">float</span> image<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
	<span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the real part of the complex&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>real<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the imaginary part of the complex&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>image<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> operator <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>complex<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">void</span> operator <span style="color: #000040;">-</span> <span style="color: #008000;">&#40;</span>complex<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> complex <span style="color: #008080;">::</span> <span style="color: #007788;">operator</span> <span style="color: #000040;">+</span>  <span style="color: #008000;">&#40;</span>complex c1<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	complex temp<span style="color: #008080;">;</span>
	temp.<span style="color: #007788;">real</span><span style="color: #000080;">=</span>real<span style="color: #000040;">+</span>c1.<span style="color: #007788;">real</span><span style="color: #008080;">;</span>
	temp.<span style="color: #007788;">image</span><span style="color: #000080;">=</span>image<span style="color: #000040;">+</span>c1.<span style="color: #007788;">image</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">image</span><span style="color: #000080;">&gt;=</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> complex no. after addition:&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">real</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;+&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">image</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;i&quot;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">else</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> complex no. after addition &quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">real</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">image</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;i&quot;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> complex <span style="color: #008080;">::</span><span style="color: #007788;">operator</span><span style="color: #000040;">-</span><span style="color: #008000;">&#40;</span>complex c1<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	complex temp<span style="color: #008080;">;</span>
	temp.<span style="color: #007788;">real</span> <span style="color: #000080;">=</span> real<span style="color: #000040;">-</span>c1.<span style="color: #007788;">image</span><span style="color: #008080;">;</span>
	temp.<span style="color: #007788;">image</span><span style="color: #000080;">=</span> image<span style="color: #000040;">-</span>c1.<span style="color: #007788;">image</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">image</span><span style="color: #000080;">&gt;=</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> complex no. after subtraction&quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> temp.real&lt;&lt;&quot;</span><span style="color: #000040;">+</span><span style="color: #FF0000;">&quot;&lt;&lt;temp.image&lt;&lt;&quot;</span>i<span style="color: #FF0000;">&quot;;
	}
	else
	{
		cout&lt;&lt;&quot;</span>\n complex no. <span style="color: #007788;">after</span> subtraction<span style="color: #FF0000;">&quot;;
		cout&lt;&lt;temp.real&lt;&lt;temp.image&lt;&lt;&quot;</span>i<span style="color: #FF0000;">&quot;
	}
}
void main()
{
	clrscr();
	comp.ex c1, c2;
	int n;
	do 
	{
		cout&lt;&lt;&quot;</span>\n <span style="color:#800080;">1.</span> Input data <span style="color: #0000ff;">for</span> complex no. <span style="color: #FF0000;">&quot;;
		cout&lt;&lt;&quot;</span>\n <span style="color:#800080;">2.</span> Addition of complex no. <span style="color: #FF0000;">&quot;;
		cout&lt;&lt;&quot;</span>\n <span style="color:#800080;">3.</span> Subtraction of complex no. <span style="color: #FF0000;">&quot;;
		cout&lt;&lt;&quot;</span>\n <span style="color:#800080;">4.</span> Quit<span style="color: #FF0000;">&quot;;
		cout&lt;&lt;&quot;</span>\n Enter your choice<span style="color: #FF0000;">&quot;;
		cin&gt;&gt;n;
		switch(n)
&nbsp;
		{ 
			 case1:
			 cout&lt;&lt;endl&lt;&lt;&quot;</span>\n Enter the data <span style="color: #0000ff;">for</span> First Complex No......<span style="color: #FF0000;">&quot;;
			 cl.getdata();
			 cout&lt;&lt;endl&lt;&lt;&quot;</span>\n Enter the data <span style="color: #0000ff;">for</span> seconds Complex No.....<span style="color: #FF0000;">&quot;;
			 c2.getdata();
			 clrscr();
			 break;
&nbsp;
			 case 2;
			 cl+c2;
			 getch();
			 clrscr();
			 break;
&nbsp;
			 case 3:
			 cl-c2;
			 getch();
			 clrscr();
			 brak;
&nbsp;
			 case 4:
			 exit91);
			 break;
			}
		} while (n!=4);
     getch();
}</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ class program to perform rational number arithmetic</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-rational-number-arithmetic/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-rational-number-arithmetic/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 13:34:26 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[rational number arithmetic]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1140</guid>
		<description><![CDATA[Write a program to perform rational number arithmetic. #include&#60;stdio.h&#62; #include&#60;iostream.h&#62; #include&#60;conio.h&#62; class rational &#123; int numer; int denom; public: void getdata&#40;&#41; &#123; cout&#60;&#60;&#34;\n enter the numerator part of the rational no.&#34;; cin&#62;&#62;numer; cout&#60;&#60;&#34;\n enter the denominator part of the rational no.&#34;; cin&#62;&#62;denom; &#125; void operator+&#40;rational&#41;; void operator-&#40;rational&#41;; void operator *&#40;rational&#41;; void operator /&#40;rational&#41;; &#125;; void [...]]]></description>
			<content:encoded><![CDATA[<p>Write a program to perform rational number arithmetic.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"> <span style="color: #339900;">#include&lt;stdio.h&gt; 	</span>
 <span style="color: #339900;">#include&lt;iostream.h&gt;</span>
 <span style="color: #339900;">#include&lt;conio.h&gt;</span>
 <span style="color: #0000ff;">class</span> rational 
 <span style="color: #008000;">&#123;</span>
	 <span style="color: #0000ff;">int</span> numer<span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">int</span> denom<span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
	 <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
	 <span style="color: #008000;">&#123;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the numerator part of the rational no.&quot;</span><span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>numer<span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> enter the denominator part of the rational no.&quot;</span><span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>denom<span style="color: #008080;">;</span>
	 <span style="color: #008000;">&#125;</span>
	 <span style="color: #0000ff;">void</span> operator<span style="color: #000040;">+</span><span style="color: #008000;">&#40;</span>rational<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">void</span> operator<span style="color: #000040;">-</span><span style="color: #008000;">&#40;</span>rational<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">void</span> operator <span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span>rational<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">void</span> operator <span style="color: #000040;">/</span><span style="color: #008000;">&#40;</span>rational<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
 <span style="color: #0000ff;">void</span> rational <span style="color: #008080;">::</span><span style="color: #007788;">operator</span><span style="color: #000040;">+</span><span style="color: #008000;">&#40;</span>rational c1<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
	 rational temp<span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">numer</span><span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>numer<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">+</span><span style="color: #008000;">&#40;</span>c1.<span style="color: #007788;">numer</span><span style="color: #000040;">*</span>denom<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">denom</span><span style="color: #000080;">=</span>denom<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>rational no. after addition&quot;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> numerator=&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">numer</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> denominator =&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0000ff;">void</span> raional <span style="color: #008080;">::</span><span style="color: #007788;">operator</span> <span style="color: #000040;">-</span><span style="color: #008000;">&#40;</span>rational c1<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
	 rational temp<span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">numer</span><span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>numer<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #008000;">&#40;</span>c1.<span style="color: #007788;">numer</span><span style="color: #000040;">*</span>denom<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">denom</span><span style="color: #000080;">=</span>denom<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> rational no. after subtraction&quot;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> numerator=&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">numer</span><span style="color: #000080;">&lt;</span>,<span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> denominator =&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0000ff;">void</span> rational <span style="color: #008080;">::</span><span style="color: #007788;">operator</span> <span style="color: #008000;">&#40;</span>rational c1<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
	 rational temp<span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">numer</span><span style="color: #000080;">=</span>numer<span style="color: #000040;">*</span>c1.<span style="color: #007788;">numer</span><span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">denom</span><span style="color: #000080;">=</span>denom<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> rational no. after multiplication&quot;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> numerator=&quot;</span><span style="color: #000080;">&lt;</span>temp.<span style="color: #007788;">numer</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> denominator =&quot;</span><span style="color: #000080;">&lt;&lt;</span> temp.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0000ff;">void</span> rational <span style="color: #008080;">::</span> <span style="color: #007788;">operator</span> <span style="color: #000040;">/</span><span style="color: #008000;">&#40;</span>rational c1<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
	 rational temp<span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">numer</span><span style="color: #000080;">=</span> numer<span style="color: #000040;">*</span>c1.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
	 temp.<span style="color: #007788;">denom</span><span style="color: #000080;">=</span>c1.<span style="color: #007788;">numer</span><span style="color: #000040;">*</span>denom<span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> rational no. after dividation&quot;</span><span style="color: #008080;">;</span>
	 <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> numerator=&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">numer</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> denominator =&quot;</span><span style="color: #000080;">&lt;&lt;</span>temp.<span style="color: #007788;">denom</span><span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span> 
	 clrscr<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	 rational c1, c2<span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">int</span> n<span style="color: #008080;">;</span>
	 <span style="color: #0000ff;">do</span> 
	 <span style="color: #008000;">&#123;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> 1.Input data for rational no. &quot;</span><span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> 2. Addition of rational no. &quot;</span><span style="color: #008080;">;</span> 
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> 3. Subtraction of rational no. &quot;</span><span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> 4. Multiplication of rational no.&quot;</span><span style="color: #008080;">;</span>
		 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>\n  <span style="color:#800080;">5.</span> Division of rational no. <span style="color: #FF0000;">&quot;;
		 cout&lt;&lt;&quot;</span>\n <span style="color:#800080;">6.</span> Quit<span style="color: #FF0000;">&quot;;
		 cout&lt;&lt;&quot;</span>\n Enter your choice<span style="color: #FF0000;">&quot;;
		 cin&gt;&gt;n;
		 switch(n)
		 {
			 case 1:
			 cout&lt;&lt;endl&lt;&lt;&quot;</span>\n enter the data <span style="color: #0000ff;">for</span> first rational no.<span style="color: #FF0000;">&quot;;
			 c1.getdata();
			 cout&lt;&lt;endl&lt;&lt;&quot;</span>\n enter the data <span style="color: #0000ff;">for</span> second rational no. <span style="color: #FF0000;">&quot;;
			 c2.getdata ();
			 clrscr();
			 break;
			 case 2;
			 c1+c2;
			 getch();
			 clrscr();
			 break;
			 case 3;
			 c1-c2;
			 getch();
			 clrscr();
			 case 4: 
			 c1*c2;
			 getch();
			 clrscr();
			 break;
			 case 5:
			 c1/c2;
			 getch();
			 clrscr();
			 break;
			 case 6:
			 exit(1);
			 break;
		 }
	 } while (n!=6);
	 getch();
 }</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-perform-rational-number-arithmetic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ program using class to multiply by 10 to every member of a list</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 13:19:02 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[multiply by 10]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1138</guid>
		<description><![CDATA[Write a program using class which reads a list of N number of integer type in an array. It modifies the list by multiplying 10 to every number of the list. The modified list is displayed. #include&#60;iostream.h&#62; #include&#60;conio.h&#62; class array &#123; public: void readarray&#40;&#41;; void multiply&#40;&#41;; &#125;; void array::readarray&#40;&#41; &#123; int a&#91;10&#93;; cout&#60;&#60;&#34;Enter the elements [...]]]></description>
			<content:encoded><![CDATA[<p>Write a program using class which reads a list of N number of integer type in an array. It modifies the list by multiplying 10 to every number of the list. The modified list is displayed.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
<span style="color: #0000ff;">class</span> array
<span style="color: #008000;">&#123;</span>
 <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span> <span style="color: #0000ff;">void</span> readarray<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
         <span style="color: #0000ff;">void</span> multiply<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">void</span> array<span style="color: #008080;">::</span><span style="color: #007788;">readarray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> a<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Enter the elements of the Array&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>i<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">9</span><span style="color: #008080;">;</span>i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
	  <span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>a<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> array<span style="color: #008080;">::</span><span style="color: #007788;">multiply</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> i,j,a<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span>,temp<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>i<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>i<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">9</span><span style="color: #008080;">;</span>i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>j<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>j<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">9</span><span style="color: #008080;">;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
		temp<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>a<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #000040;">*</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Result are as follows&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>j<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>j<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">9</span><span style="color: #008080;">;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>temp<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	array mul<span style="color: #008080;">;</span>
	clrscr<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	mul.<span style="color: #007788;">readarray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	mul.<span style="color: #007788;">multiply</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ program to copy one file to anothere file</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-copy-one-file-to-anothere-file/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-copy-one-file-to-anothere-file/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:14:35 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c++ files]]></category>
		<category><![CDATA[File operations]]></category>
		<category><![CDATA[lower case]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[upper case]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1073</guid>
		<description><![CDATA[AIM A program to copy one file to another file and convert the lower case characters to upper case characters. ALGORITHM 1) Start the process 2) Create the input file and out put file. 3) Get the input file name to fname1. 4) Get the output file name to fname2. 5) Open the infile(fanme1) 6) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	A program to copy one file to another file and convert the lower case characters to upper case characters.</p>
<p><strong>ALGORITHM </strong></p>
<p>1)	Start the process<br />
2)	Create the input file and out put file.<br />
3)	Get the input file name to fname1.<br />
4)	Get the output file name to fname2.<br />
5)	Open the infile(fanme1)<br />
6)	Check if infile.fail()<br />
a)	True:<br />
i)	Execute error conversion<br />
ii)	exit<br />
7)	open the outfile(fanme2)<br />
 <img src='http://electrofriends.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> check if outfile.fail()<br />
a)	repeat step(6:a)<br />
9)	check while infile.eof()<br />
a)	True:<br />
i)	 Ch?(char)infile.get()<br />
10)	Close both files<br />
11)	Stop the process.</p>
<p><strong>PROGRAM :</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
<span style="color: #339900;">#include&lt;iomanip.h&gt;</span>
<span style="color: #339900;">#include&lt;stdlib.h&gt;</span>
<span style="color: #339900;">#include&lt;ctype.h&gt;</span>
<span style="color: #339900;">#include&lt;fstream.h&gt;</span>
&nbsp;
<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	ofstream outfile<span style="color: #008080;">;</span>
	ifstream  infile<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">char</span> fname1<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span>,fname2<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">char</span> ch,uch<span style="color: #008080;">;</span>
	clrscr<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Enter a file name to be copied &quot;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span> fname1<span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Enter new file name&quot;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>fname2<span style="color: #008080;">;</span>
	infile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span>fname1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> infile.<span style="color: #007788;">fail</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cerr</span><span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; No such a file Exit&quot;</span><span style="color: #008080;">;</span>
		getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	outfile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span> fname2<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>outfile.<span style="color: #007788;">fail</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000dd;">cerr</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Unable to create a file&quot;</span><span style="color: #008080;">;</span>
			getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span> <span style="color: #000040;">!</span>infile.<span style="color: #007788;">eof</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		ch <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #008000;">&#41;</span> infile.<span style="color: #007788;">get</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		uch <span style="color: #000080;">=</span> <span style="color: #0000dd;">toupper</span><span style="color: #008000;">&#40;</span>ch<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		outfile.<span style="color: #007788;">put</span><span style="color: #008000;">&#40;</span>uch<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	infile.<span style="color: #007788;">close</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	outfile.<span style="color: #007788;">close</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	getch<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT:</strong></p>
<p>	Enter a file name to be copied.<br />
		C:\text1.txt<br />
	Enter new file name<br />
		D:\new.txt</p>
<p>Input file<br />
		Asbcdefghijklmnopqrstuvwxyz<br />
Output file<br />
		ASBCDEFGHIJKLMNOPQRSTUVWXYZ</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-copy-one-file-to-anothere-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C++ class program to illestrate File operations</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-illestrate-file-operations/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-illestrate-file-operations/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:08:00 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c++ class]]></category>
		<category><![CDATA[file open]]></category>
		<category><![CDATA[File operations]]></category>
		<category><![CDATA[file write]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1070</guid>
		<description><![CDATA[AIM Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file. ALGORITHM 1. Start the process 2. Invoke the class a. Create two inline member functions .ie, getdata() and dispdata() i. getdata() for input ii. dispdata() for display 3. Open the file in fstream [...]]]></description>
			<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file.</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class<br />
a.	Create two inline member functions .ie, getdata() and dispdata()<br />
i.	getdata() for input<br />
ii.	dispdata() for display<br />
3.	Open the file in fstream mode<br />
4.	Write the data in to the file<br />
5.	Slose the file<br />
6.	Stop the process</p>
<p><strong>PROGRAM</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
<span style="color: #339900;">#include&lt;fstream.h&gt;</span>
<span style="color: #0000ff;">class</span> student
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
<span style="color: #0000ff;">int</span> rno<span style="color: #008080;">;</span>
<span style="color: #0000ff;">char</span> name<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">float</span> fees<span style="color: #008080;">;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
<span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;roll number&quot;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>rno<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;enter name:&quot;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>name<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;enter fees:&quot;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>fees<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> dispdata<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Roll number&quot;</span><span style="color: #000080;">&lt;&lt;</span>rno<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Name&quot;</span><span style="color: #000080;">&lt;&lt;</span>name<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Fees&quot;</span><span style="color: #000080;">&lt;&lt;</span>fees<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
student s1<span style="color: #008080;">;</span>
clrscr<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
ofstream stdfile<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;c:\\std.txt&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #666666;">//fstream stdfile;</span>
<span style="color: #666666;">//stdfile.open(&quot;c:\\std.txt&quot;,ios::out|ios::in);  //open file for output</span>
<span style="color: #0000ff;">char</span> wish<span style="color: #008080;">;</span>
<span style="color: #666666;">//writing to the file</span>
<span style="color: #0000ff;">do</span>
<span style="color: #008000;">&#123;</span>
s1.<span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
stdfile.<span style="color: #007788;">write</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">&amp;</span>s1,<span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>student<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;continue ? y/n&quot;</span><span style="color: #008080;">;</span>
<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>wish<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span>wish<span style="color: #000080;">==</span><span style="color: #FF0000;">'y'</span><span style="color: #000040;">||</span>wish<span style="color: #000080;">==</span><span style="color: #FF0000;">'Y'</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
stdfile.<span style="color: #007788;">close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>   <span style="color: #666666;">//close the file</span>
&nbsp;
getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT</strong></p>
<p>Roll number  121<br />
Enter name  Jacob<br />
Enter fees   10000</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-class-program-to-illestrate-file-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ program to implement Pure Virtual Functions</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-implement-pure-virtual-functions/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-implement-pure-virtual-functions/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:04:10 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[base class]]></category>
		<category><![CDATA[C++ virtual functions]]></category>
		<category><![CDATA[derived class]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Pure Virtual Functions]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1068</guid>
		<description><![CDATA[AIM A program to demonstrate how a pure virtual function is defined, declared and invoked from the object of derived class through the pointer of the base class. ALGORITHM 1. Start the process 2. Invoke the class with pointer 3. Assign ptrgetdata() a. Get the roll no and name of the student 5. Call the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	A program to demonstrate how a pure virtual function is defined, declared and invoked from the object of derived class through the pointer of the base class.</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class with pointer<br />
3.	Assign ptr<-&#038;obj<br />
4.	Call the ptr->getdata()<br />
a.	Get the roll no and name of the student<br />
5.	Call the ptr->display()<br />
a.	Print the roll no and name<br />
6.	Stop the process</p>
<p><strong>PROGRAM</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
	<span style="color: #339900;">#include&lt;conio.h&gt;</span>
&nbsp;
	<span style="color: #0000ff;">class</span>  base 
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span> <span style="color: #0000ff;">int</span> x<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">float</span> y<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">public</span> <span style="color: #008080;">:</span> <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">class</span> dev <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> base
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>  <span style="color: #0000ff;">int</span> roll<span style="color: #008080;">;</span>
			 <span style="color: #0000ff;">char</span> name<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">public</span> <span style="color: #008080;">:</span> <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">void</span>  display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>	
	<span style="color: #0000ff;">void</span> base <span style="color: #008080;">::</span> <span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>  <span style="color: #008000;">&#123;</span>  <span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> base <span style="color: #008080;">::</span> <span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>   <span style="color: #008000;">&#123;</span>  <span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0000ff;">void</span> dev <span style="color: #008080;">::</span> <span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>” Enter Roll of  the Student “<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span> roll<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>” Enter name of  the student”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>name<span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> dev <span style="color: #008080;">::</span> <span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Name is <span style="color: #008080;">:</span>”<span style="color: #000080;">&lt;&lt;</span>name<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>” Roll no is <span style="color: #008080;">:</span>”<span style="color: #000080;">&lt;&lt;</span>roll <span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		base <span style="color: #000040;">*</span> ptr<span style="color: #008080;">;</span>
		dev obj<span style="color: #008080;">;</span>
		clrscr<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr <span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>obj<span style="color: #008080;">;</span>
		ptr <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		getch<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT</strong></p>
<p>Enter the roll no of the student: 111<br />
Enter the name of the student : Kapil Dev</p>
<p>Name is : Kapil Dev<br />
Roll no is : 111</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-implement-pure-virtual-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ program to illestrate virtual functions</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illestrate-virtual-functions/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illestrate-virtual-functions/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:59:23 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[array of members]]></category>
		<category><![CDATA[c++ virtual]]></category>
		<category><![CDATA[derived class]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[virtual functions]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1066</guid>
		<description><![CDATA[AIM A program to access the member of the derived class objects through an array of members. In this program, both the base class and the derived class member functions are preceded by the keyword ALGORITHM 1. Start the process 2. Invoke the class with pointer 3. Assign ptr[0]]]></description>
			<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	A program to access the member of the derived class objects through an array of members. In this program, both the base class and the derived class member functions are preceded by the keyword</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class with pointer<br />
3.	Assign ptr[0] <- &objb;<br />
i.	Assign ptr[1] <- &objc;<br />
4.	Ptr(0)points the getdata()<br />
a.	Get the values of x and y<br />
5.	Ptr(1) points to the getdata()<br />
a.	Get the roll no and name of the student<br />
6.	Ptr(0) and ptr(1) are points to the display()<br />
a.	Print the values<br />
7.	Stop the process</p>
<p><strong>PROGRAM</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
&nbsp;
	<span style="color: #0000ff;">class</span> base
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span> <span style="color: #0000ff;">int</span> x<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">float</span> y<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>  
			<span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">class</span> devb<span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> base
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span> <span style="color: #0000ff;">int</span> roll<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">char</span> name<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>  <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">class</span> devc <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span>  base
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span> <span style="color: #0000ff;">float</span> height<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">float</span> weight<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">public</span> <span style="color: #008080;">:</span> <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			 <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #008080;">:</span>
	<span style="color: #0000ff;">void</span> base <span style="color: #008080;">::</span> <span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>” Enter any Integer”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>x<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Enter a real no”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>y<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> base <span style="color: #008080;">::</span><span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”The no X<span style="color: #000080;">=</span>”<span style="color: #000080;">&lt;&lt;</span>x<span style="color: #000080;">&lt;&lt;</span>”Y<span style="color: #000080;">=</span>”<span style="color: #000080;">&lt;&lt;</span>y<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> devb <span style="color: #008080;">::</span> <span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Roll of the Student is<span style="color: #008080;">:</span>”<span style="color: #000080;">&lt;&lt;</span>roll<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>” Name of the Student is<span style="color: #008080;">:</span> “<span style="color: #000080;">&lt;&lt;</span>name<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> devb <span style="color: #008080;">::</span> <span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Enter the Roll of  the Student<span style="color: #008080;">:</span>”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>roll<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Enter Name of Student <span style="color: #008080;">:</span>”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>name<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> devc <span style="color: #008080;">::</span> <span style="color: #007788;">getdata</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Enter height and weight”<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cin</span><span style="color: #000080;">&gt;&gt;</span>height<span style="color: #000080;">&gt;&gt;</span>weight<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> devc <span style="color: #008080;">::</span> <span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Height <span style="color: #008080;">:</span>”<span style="color: #000080;">&lt;&lt;</span>height<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span>”Weight <span style="color: #008080;">:</span>”<span style="color: #000080;">&lt;&lt;</span>weight<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">void</span> main<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		base <span style="color: #000040;">*</span>ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		devb objb<span style="color: #008080;">;</span>
		devc objc<span style="color: #008080;">;</span>
		clrscr<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>objb<span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #000040;">&amp;</span>objc<span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span> getdata<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		ptr<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span> display<span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		getch <span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  	<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT</strong></p>
<p>Enter the Roll of  the Student: 101<br />
Enter Name of Student : salah<br />
height and weight 170 72</p>
<p>Roll of  the Student is:101<br />
Name of  the Student is:salah<br />
Height :170<br />
Weight :72</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illestrate-virtual-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ program to illustrate the static member function</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-the-static-member-function/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-the-static-member-function/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:09:40 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[static functions]]></category>
		<category><![CDATA[static member function]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1064</guid>
		<description><![CDATA[AIM Write a program to illustrate the static member function. ALGORITHM 1. Start the process 2. Invoke the class i. Set the data member and member function as a static b. Create two objects t1 and t2 3. Call the function t1.setcode i. Increment the value of data member count 4. Call the function t1.setcode [...]]]></description>
			<content:encoded><![CDATA[<p><strong>AIM</strong><br />
Write a program to illustrate the static member function.</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class<br />
i.	Set the data member and member function as a static<br />
b.	Create two objects t1 and t2<br />
3.	Call the function t1.setcode<br />
i.	Increment the value of data member count<br />
4.	Call the function t1.setcode<br />
i.	Increment the value of data member count<br />
5.	Call the static member function showcount()<br />
i.	Display the value of count<br />
6.	Create a new object t3<br />
7.	Call the function t3.set code()<br />
8.	Call t1.showcount(), t2.showcount() and t3.showcount()<br />
9.	Stop the process</p>
<p><strong>PROGRAM</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
&nbsp;
<span style="color: #0000ff;">class</span> test
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> code<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> count<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">public</span> <span style="color: #008080;">:</span>
		<span style="color: #0000ff;">void</span> setcode<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			code<span style="color: #000080;">=</span> <span style="color: #000040;">++</span>count<span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">void</span> showcode<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;object number&quot;</span><span style="color: #000080;">&lt;&lt;</span>code<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> showcount<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;count&quot;</span><span style="color: #000080;">&lt;&lt;</span>count<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">int</span> test<span style="color: #008080;">::</span><span style="color: #007788;">count</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	clrscr<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	test t1,t2<span style="color: #008080;">;</span>
	t1.<span style="color: #007788;">setcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	t2.<span style="color: #007788;">setcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	test<span style="color: #008080;">::</span><span style="color: #007788;">showcount</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	test t3<span style="color: #008080;">;</span>
	t3.<span style="color: #007788;">setcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
test<span style="color: #008080;">::</span><span style="color: #007788;">showcount</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	t1.<span style="color: #007788;">showcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	t2.<span style="color: #007788;">showcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	t3.<span style="color: #007788;">showcode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">return</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>	    
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT</strong></p>
<p>	Count 2<br />
	Count 3<br />
	Object number 1<br />
	Object number 2<br />
	Object number 3</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-the-static-member-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C++ program to illustrate Hybrid Inheritance.</title>
		<link>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-hybrid-inheritance/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-hybrid-inheritance/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 16:34:11 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[cpp class]]></category>
		<category><![CDATA[Hybrid Inheritance]]></category>
		<category><![CDATA[protected]]></category>
		<category><![CDATA[public]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1062</guid>
		<description><![CDATA[C++ program to illustrate Hybrid Inheritance. #include&#60;iostream.h&#62; #include&#60;conio.h&#62; class stu &#123; protected: int rno; public: void get_no&#40;int a&#41; &#123; rno=a; &#125; void put_no&#40;void&#41; &#123; out&#60;&#60;&#34;Roll no&#34;&#60;&#60;rno&#60;&#60;&#34;\n&#34;; &#125; &#125;; class test:public stu &#123; protected: float part1,part2; public: void get_mark&#40;float x,float y&#41; &#123; part1=x; part2=y; &#125; void put_marks&#40;&#41; &#123; cout&#60;&#60;&#34;Marks obtained:&#34;&#60;&#60;&#34;part1=&#34;&#60;&#60;part1&#60;&#60;&#34;\n&#34;&#60;&#60;&#34;part2=&#34;&#60;&#60;part2&#60;&#60;&#34;\n&#34;; &#125; &#125;; class sports &#123; protected: [...]]]></description>
			<content:encoded><![CDATA[<p>C++ program to illustrate Hybrid Inheritance.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include&lt;iostream.h&gt;</span>
<span style="color: #339900;">#include&lt;conio.h&gt;</span>
<span style="color: #0000ff;">class</span> stu
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">protected</span><span style="color: #008080;">:</span>
  	<span style="color: #0000ff;">int</span> rno<span style="color: #008080;">;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
 	<span style="color: #0000ff;">void</span> get_no<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> a<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
rno<span style="color: #000080;">=</span>a<span style="color: #008080;">;</span>
 	<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> put_no<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
 	<span style="color: #008000;">&#123;</span>
 		out<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Roll no&quot;</span><span style="color: #000080;">&lt;&lt;</span>rno<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
 	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">class</span> test<span style="color: #008080;">:</span><span style="color: #0000ff;">public</span> stu
<span style="color: #008000;">&#123;</span>
  	<span style="color: #0000ff;">protected</span><span style="color: #008080;">:</span>
  	<span style="color: #0000ff;">float</span> part1,part2<span style="color: #008080;">;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
  <span style="color: #0000ff;">void</span> get_mark<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">float</span> x,<span style="color: #0000ff;">float</span> y<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
   	part1<span style="color: #000080;">=</span>x<span style="color: #008080;">;</span>
   	part2<span style="color: #000080;">=</span>y<span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> put_marks<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Marks obtained:&quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;part1=&quot;</span><span style="color: #000080;">&lt;&lt;</span>part1<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;part2=&quot;</span><span style="color: #000080;">&lt;&lt;</span>part2<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">class</span> sports
<span style="color: #008000;">&#123;</span>
 	<span style="color: #0000ff;">protected</span><span style="color: #008080;">:</span>
 	<span style="color: #0000ff;">float</span> score<span style="color: #008080;">;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
 <span style="color: #0000ff;">void</span> getscore<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">float</span> s<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
  	score<span style="color: #000080;">=</span>s<span style="color: #008080;">;</span>
 <span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">void</span> putscore<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;sports:&quot;</span><span style="color: #000080;">&lt;&lt;</span>score<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">class</span> result<span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> test, <span style="color: #0000ff;">public</span> sports
<span style="color: #008000;">&#123;</span>
 	<span style="color: #0000ff;">float</span> total<span style="color: #008080;">;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
 	<span style="color: #0000ff;">void</span> display<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">void</span> result<span style="color: #008080;">::</span><span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 	total<span style="color: #000080;">=</span>part1<span style="color: #000040;">+</span>part2<span style="color: #000040;">+</span>score<span style="color: #008080;">;</span>
 	put_no<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	put_marks<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	putscore<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Total Score=&quot;</span><span style="color: #000080;">&lt;&lt;</span>total<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 	clrscr<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	result stu<span style="color: #008080;">;</span>
 	stu.<span style="color: #007788;">get_no</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">123</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	stu.<span style="color: #007788;">get_mark</span><span style="color: #008000;">&#40;</span><span style="color:#800080;">27.5</span>,<span style="color:#800080;">33.0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	stu.<span style="color: #007788;">getscore</span><span style="color: #008000;">&#40;</span><span style="color:#800080;">6.0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	stu.<span style="color: #007788;">display</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
 	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>OUTPUT</strong></p>
<p>	Roll no  123<br />
	Marks obtained : part1=27.5<br />
	Part2=33<br />
	Sports=6<br />
	Total score = 66.5</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-advanced-programs/c-program-to-illustrate-hybrid-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
