<?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>cpp | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/cpp/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sun, 04 Apr 2010 13:34:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ class program to perform rational number arithmetic</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-rational-number-arithmetic/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-rational-number-arithmetic/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 04 Apr 2010 13:34:26 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[rational number arithmetic]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1140</guid>

					<description><![CDATA[<p>Write a program to perform rational number arithmetic. #include #include #include class rational { int numer; int denom; public: void getdata() { coutnumer; coutdenom; } void operator+(rational); void operator-(rational); void operator *(rational); void operator /(rational); }; void rational ::operator+(rational c1) { rational temp; temp.numer=(numer*c1.denom)+(c1.numer*denom); temp.denom=denom*c1.denom; cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-rational-number-arithmetic/">C++ class program to perform rational number arithmetic</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a program to perform rational number arithmetic.</p>
<pre lang="cpp">
 #include<stdio.h> 	
 #include<iostream.h>
 #include<conio.h>
 class rational 
 {
	 int numer;
	 int denom;
	 public:
	 void getdata()
	 {
		 cout<<"\n enter the numerator part of the rational no.";
		 cin>>numer;
		 cout<<"\n enter the denominator part of the rational no.";
		 cin>>denom;
	 }
	 void operator+(rational);
	 void operator-(rational);
	 void operator *(rational);
	 void operator /(rational);
 };
 void rational ::operator+(rational c1)
 {
	 rational temp;
	 temp.numer=(numer*c1.denom)+(c1.numer*denom);
	 temp.denom=denom*c1.denom;
	 cout<<"\nrational no. after addition";
	 cout<<"\n numerator="<<temp.numer<<"\n denominator ="<<temp.denom;
 }
 void raional ::operator -(rational c1)
 {
	 rational temp;
	 temp.numer=(numer*c1.denom)-(c1.numer*denom);
	 temp.denom=denom*c1.denom;
	 cout<<"\n rational no. after subtraction";
	 cout<<"\n numerator="<<temp.numer<,"\n denominator ="<<temp.denom;
 }
 void rational ::operator (rational c1)
 {
	 rational temp;
	 temp.numer=numer*c1.numer;
	 temp.denom=denom*c1.denom;
	 cout<<"\n rational no. after multiplication";
	 cout <<"\n numerator="<temp.numer<<"\n denominator ="<< temp.denom;
 }
 void rational :: operator /(rational c1)
 {
	 rational temp;
	 temp.numer= numer*c1.denom;
	 temp.denom=c1.numer*denom;
	 cout<<"\n rational no. after dividation";
	 cout <<"\n numerator="<<temp.numer<<"\n denominator ="<<temp.denom;
 }
 void main()
 { 
	 clrscr();
	 rational c1, c2;
	 int n;
	 do 
	 {
		 cout<<"\n 1.Input data for rational no. ";
		 cout<<"\n 2. Addition of rational no. "; 
		 cout<<"\n 3. Subtraction of rational no. ";
		 cout<<"\n 4. Multiplication of rational no.";
		 cout<<\n  5. Division of rational no. ";
		 cout<<"\n 6. Quit";
		 cout<<"\n Enter your choice";
		 cin>>n;
		 switch(n)
		 {
			 case 1:
			 cout<<endl<<"\n enter the data for first rational no.";
			 c1.getdata();
			 cout<<endl<<"\n enter the data for second rational no. ";
			 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();
 }
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-rational-number-arithmetic/">C++ class program to perform rational number arithmetic</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-rational-number-arithmetic/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program using class to multiply by 10 to every member of a list</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 04 Apr 2010 13:19:02 +0000</pubDate>
				<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://studentprojects.in/?p=1138</guid>

					<description><![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. #include #include class array { public: void readarray(); void multiply(); }; void array::readarray() { int a[10]; cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/">C++ program using class to multiply by 10 to every member of a list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></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>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
class array
{
 public: void readarray();
         void multiply();
};
void array::readarray()
{
	int a[10];
	cout<<"Enter the elements of the Array"<<endl;
	for(int i=0;i<=9;i++)
	  cin>>a[i];
}
void array::multiply()
{
	int i,j,a[10],temp[10];
	for(i=0;i<=9;i++)
	{
		for(j=0;j<=9;j++)
		temp[i]=(a[i]*10);
	}
	cout<<"Result are as follows"<<endl;
	for(j=0;j<=9;j++)
		cout<<temp[j]<<endl;
}
void main()
{
	array mul;
	clrscr();
	mul.readarray();
	mul.multiply();
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/">C++ program using class to multiply by 10 to every member of a list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-using-class-to-multiply-by-10-to-every-member-of-a-list/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to multiply two numbers without using multiplication operator</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-multiply-two-numbers-without-using-multiplication-operator/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-multiply-two-numbers-without-using-multiplication-operator/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 04 Apr 2010 10:11:00 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[multiply two numbers]]></category>
		<category><![CDATA[without using multiplication operator]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1130</guid>

					<description><![CDATA[<p>Write a c++ program to multiply two numbers without using multiplication operator. #include #include void main () { int a,b,i,temp=0; clrscr(); couta>>b; for(i=1;i</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-multiply-two-numbers-without-using-multiplication-operator/">C++ program to multiply two numbers without using multiplication operator</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a c++ program to multiply two numbers without using multiplication operator.</p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
void main ()
{
int a,b,i,temp=0;
clrscr();
cout<<"Enter Two numbers for multiplication";
cin>>a>>b;
for(i=1;i<=b;i++)
{
temp=temp+a;
}
cout<<endl<<"Result are:: "<<temp;
getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-multiply-two-numbers-without-using-multiplication-operator/">C++ program to multiply two numbers without using multiplication operator</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-multiply-two-numbers-without-using-multiplication-operator/feed/</wfw:commentRss>
			<slash:comments>18</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to illustrate Hybrid Inheritance.</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-hybrid-inheritance/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-hybrid-inheritance/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 16:34:11 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[protected]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[cpp class]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[Hybrid Inheritance]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1062</guid>

					<description><![CDATA[<p>C++ program to illustrate Hybrid Inheritance. #include #include class stu { protected: int rno; public: void get_no(int a) { rno=a; } void put_no(void) { out</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-hybrid-inheritance/">C++ program to illustrate Hybrid Inheritance.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>C++ program to illustrate Hybrid Inheritance.</p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
class stu
{
protected:
  	int rno;
public:
 	void get_no(int a)
{
rno=a;
 	}
void put_no(void)
 	{
 		out<<"Roll no"<<rno<<"\n";
 	}
};
class test:public stu
{
  	protected:
  	float part1,part2;
public:
  void get_mark(float x,float y)
  {
   	part1=x;
   	part2=y;
  }
void put_marks()
{
 cout<<"Marks obtained:"<<"part1="<<part1<<"\n"<<"part2="<<part2<<"\n";
}
};
class sports
{
 	protected:
 	float score;
public:
 void getscore(float s)
 {
  	score=s;
 }
void putscore(void)
{
 	cout<<"sports:"<<score<<"\n";

}
};

class result: public test, public sports
{
 	float total;
public:
 	void display(void);
};
void result::display(void)
{
 	total=part1+part2+score;
 	put_no();
 	put_marks();
 	putscore();
 	cout<<"Total Score="<<total<<"\n";
}
int main()
{
 	clrscr();
 	result stu;
 	stu.get_no(123);
 	stu.get_mark(27.5,33.0);
 	stu.getscore(6.0);
 	stu.display();
 	return 0;
}
</pre>
<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><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-hybrid-inheritance/">C++ program to illustrate Hybrid Inheritance.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-hybrid-inheritance/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement three classes using multiple inheritance</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 15:11:45 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[codes]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[implement three class]]></category>
		<category><![CDATA[multiple inheritance]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1060</guid>

					<description><![CDATA[<p>MULTIPLE INHERITANCES AIM: Write a program to illustrating how all the three classes are implemented in multiple inheritance mode ALGORITHM • Start the process • Invoke the class M • Invoke the another class N • Invoke one more class,ie class P,which is inherited by both M and N • Create an object for class</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/">C++ program to implement three classes using multiple inheritance</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>MULTIPLE INHERITANCES</strong></p>
<p><strong>AIM:</strong><br />
Write a program to illustrating how all the three classes are implemented in multiple inheritance mode</p>
<p><strong>ALGORITHM</strong><br />
•	Start the process<br />
•	Invoke the class M<br />
•	Invoke the another class N<br />
•	Invoke one more class,ie class P,which is inherited by both M and N<br />
•	Create an object for class p,ie P p<br />
•	Call p.get_m(),assign the value in to ‘m’<br />
•	Call p.get_n(),assign the value in to ‘n’<br />
•	Call display(), for dispay the result<br />
•	Stop the result </p>
<p><strong>PROGRAM:</strong></p>
<pre lang="cpp">
	#include<iosteram.h>
	#include<conio.h>
	
	Class M
        {
		Protected:
		Int m;
		Public :
		Void get_M();
	};
	Class N
        {		
		Protected:
		Int n;
		Public:
		Void get_N();
	};
	Class p: public M, public N 		
	{
		Public:
		Void disply(void);
	};
	Void M ::get_m(int x)
	{
		m=x;
	}
	Void N::get_n(int y)
	{
		n=y;
	}
	Void P:: disply(void)
	{
	Cout<<”m=”<<m<<endl;
	Cout<<”n=”<<n<<endl;
	Cout<<”m*n=”<<m*n<<endl;
	}
	int main()
	{
		P p;
		p.get_m(10);
		p.get_n(20);
		p.display();
		return 0;
	}
</pre>
<p><strong>OUTPUT</strong></p>
<p>	m=10<br />
	n=20<br />
	m*n=200</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/">C++ program to implement three classes using multiple inheritance</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program for overloading the unary operator ++.</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-overloading-the-unary-operator/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-overloading-the-unary-operator/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 12:42:46 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c++ overloading]]></category>
		<category><![CDATA[operator ++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Source Codes]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1052</guid>

					<description><![CDATA[<p>ALGORITHAM: • Start the process • Invoke the class counter • Crate two objects c1 and c2 • Assign values to c1 an c2 o Call c1.get_count() o Call c2.get_count() • Increment the values o C1++ o C2++ o ++c2 • Print c1 and c2 • Stop the process PROGRAM #include #include class counter {</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-overloading-the-unary-operator/">C++ program for overloading the unary operator ++.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>ALGORITHAM: </strong><br />
•	Start the process<br />
•	Invoke the class counter<br />
•	Crate two objects c1 and c2<br />
•	Assign values to c1 an c2<br />
o	Call c1.get_count()<br />
o	Call c2.get_count()<br />
•	Increment the values<br />
o	C1++<br />
o	C2++<br />
o	++c2<br />
•	Print c1 and c2<br />
•	Stop the process</p>
<p><strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
class counter
{
int count;
public:
counter()
{
	count=0;
}
int get_count()
{
return count;
}
void operator++()
{
count++;
}
};

void main()
{
counter c1,c2;
cout<<"\nC1 ="<<c1.get_count();
cout<<"\nC2 ="<<c2.get_count();

c1++; 		//Using overloaded ++ operator.
c2++;
++c2;
cout<<"\nC1 ="<<c1.get_count();
cout<<"\nC2 ="<<c2.get_count();
getch();
}
</pre>
<p><strong>OUT PUT:</strong><br />
		C1=0  C2=O<br />
		C1=1	C2=2</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-overloading-the-unary-operator/">C++ program for overloading the unary operator ++.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-overloading-the-unary-operator/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>c++ Program to illustrate the use of difference operators using friend function</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 04:29:18 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[difference operators]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[friend function]]></category>
		<category><![CDATA[c++ class]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1048</guid>

					<description><![CDATA[<p>AIM: A program to illustrate the use of difference operators to access the class member using friend function ALGORITHM: 1) Start the process 2) Invoke the classes 3) Call the set_xy() first a) Assign the value of x and y b) Print the value of x and y 4) Call the sum() for second(friend) a)</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/">c++ Program to illustrate the use of difference operators using friend function</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM: </strong><br />
A program to illustrate the use of difference operators to access the class member using friend function<br />
<strong><br />
ALGORITHM: </strong></p>
<p>1)	Start the process<br />
2)	Invoke the classes<br />
3)	Call the set_xy() first<br />
a)	Assign the value of x and y<br />
b)	Print the value of x and y<br />
4)	Call the sum() for second(friend)<br />
a)	Again assign the temp value of x and y<br />
5)	Print the value of x and y<br />
6)	Stop the process</p>
<p><strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
class M
{
int x;
int y;
public:
void set_xy(int a,int b)
{
x=a;
y=b;
}
friend int sum(M m);
};
int sum(M m)
{
int M ::* px=&M :: x;
int M ::* py=&M :: y;
M *pm=&m;
int s=m.*px + pm->*py;
return s;
}
main()
{
M n;
void (M :: *pf)(int,int)=&M :: set_xy;
(n.*pf)(10,20);
cout<<"Sum="<<sum(n)<<"\n";
M *op=&n;
(op->*pf)(30,40);
cout<<"Sum="<<sum(n)<<"\n";
return(0);
}
</pre>
<p><strong>Output:</strong></p>
<p>	Sum=30<br />
	Sum=70</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/">c++ Program to illustrate the use of difference operators using friend function</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program that uses dynamic programming algorithm to solve the optimal binary search tree problem</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-dynamic-programming-algorithm-to-solve-the-optimal-binary-search-tree-problem/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-dynamic-programming-algorithm-to-solve-the-optimal-binary-search-tree-problem/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 17:39:44 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[binary tree]]></category>
		<category><![CDATA[optimal binary search tree]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1042</guid>

					<description><![CDATA[<p>/* Write a C++ program that uses dynamic programming algorithm to solve the optimal binary search tree problem */ #include #include #include using namespace std; #define MAX 10 int find(int i,int j); void print(int,int); int p[MAX],q[MAX],w[10][10],c[10][10],r[10][10],i,j,k,n,m; char idnt[7][10]; main() { cout >n; cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-dynamic-programming-algorithm-to-solve-the-optimal-binary-search-tree-problem/">C++ program that uses dynamic programming algorithm to solve the optimal binary search tree problem</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write a C++ program that uses dynamic programming algorithm to solve the optimal binary search tree problem */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
#define MAX 10
int find(int i,int j);
void print(int,int);
int p[MAX],q[MAX],w[10][10],c[10][10],r[10][10],i,j,k,n,m;
char idnt[7][10];

main()
{
	cout << "enter the no, of identifiers";
	cin >>n;
	cout <<"enter identifiers";
	for(i=1;i<=n;i++)
	gets(idnt[i]);
	cout <<"enter success propability for identifiers";
	for(i=1;i<=n;i++)
		cin >>p[i];
	cout << "enter failure propability for identifiers";
	for(i=0;i<=n;i++)
		cin >> q[i];
	for(i=0;i<=n;i++)
	{
		w[i][i]=q[i];
		c[i][i]=r[i][i]=0;
		w[i][i+1]=q[i]+q[i+1]+p[i+1];
		r[i][i+1]=i+1;
		c[i][i+1]=q[i]+q[i+1]+p[i+1];
	}
	w[n][n]=q[n];
	r[n][n]=c[n][n]=0;
	for(m=2;m<=n;m++)
	{
		for(i=0;i<=n-m;i++)
		{
		     j=i+m;
		     w[i][j]=w[i][j-1]+p[j]+q[j];
		     k=find(i,j);
		     r[i][j]=k;
		     c[i][j]=w[i][j]+c[i][k-1]+c[k][j];
		}
	}
       cout <<"\n";
       print(0,n); }

int find(int i,int j)
{
int min=2000,m,l;
for(m=i+1;m<=j;m++)
if(c[i][m-1]+c[m][j]<min)
{
min=c[i][m-1]+c[m][j];
l=m;
}
return l;
}
void print(int i,int j)
{
if(i<j)
puts(idnt[r[i][j]]);
else
return;
print(i,r[i][j]-1);
print(r[i][j],j);
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>enter the no, of identifiers4<br />
enter identifiers<br />
do<br />
if<br />
int<br />
while<br />
enter success propability for identifiers3 3 1 1<br />
enter failure propability for identifiers2 3 1 1 1</p>
<p>tree in preorder form<br />
if<br />
do<br />
int<br />
while</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-dynamic-programming-algorithm-to-solve-the-optimal-binary-search-tree-problem/">C++ program that uses dynamic programming algorithm to solve the optimal binary search tree problem</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-dynamic-programming-algorithm-to-solve-the-optimal-binary-search-tree-problem/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>C++ programs for sorting numbers in ascending order using Quick sort method</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-programs-for-sorting-numbers-in-ascending-order-using-quick-sort-method/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-programs-for-sorting-numbers-in-ascending-order-using-quick-sort-method/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 17:27:51 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[programs]]></category>
		<category><![CDATA[sorting numbers]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Quick sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1035</guid>

					<description><![CDATA[<p>/* Write C++ programs for sorting a given list of elements in ascending order using Quick sort sorting methods */ #include #include int a[10],l,u,i,j; void quick(int *,int,int); void main() { clrscr(); cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-programs-for-sorting-numbers-in-ascending-order-using-quick-sort-method/">C++ programs for sorting numbers in ascending order using Quick sort method</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ programs for sorting a given list of elements in ascending order using Quick sort sorting methods */</p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
int a[10],l,u,i,j;
void quick(int *,int,int);
void main()
{
clrscr();
cout <<"enter 10 elements";
for(i=0;i<10;i++)
cin >> a[i];
l=0;
u=9;
quick(a,l,u);
cout <<"sorted elements";
for(i=0;i<10;i++)
cout << a[i] << " ";
getch();
}

void quick(int a[],int l,int u)
{
   int p,temp;
   if(l<u)
   {
   p=a[l];
   i=l;
   j=u;
    while(i<j)
   {
      while(a[i] <= p &#038;&#038; i<j )
	 i++;
      while(a[j]>p && i<=j )
	   j--;
      if(i<=j)
      {
      temp=a[i];
      a[i]=a[j];
      a[j]=temp;}
  }
  temp=a[j];
  a[j]=a[l];
  a[l]=temp;
  cout <<"\n";
  for(i=0;i<10;i++)
  cout <<a[i]<<" ";
  quick(a,l,j-1);
  quick(a,j+1,u); 
 }
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>enter 10 elements5 2 3 16 25 1 20 7 8 61 14</p>
<p>1 2 3 5 25 16 20 7 8 61<br />
1 2 3 5 25 16 20 7 8 61<br />
1 2 3 5 25 16 20 7 8 61<br />
1 2 3 5 25 16 20 7 8 61<br />
1 2 3 5 25 16 20 7 8 61<br />
1 2 3 5 8 16 20 7 25 61<br />
1 2 3 5 7 8 20 16 25 61<br />
1 2 3 5 7 8 16 20 25 61<br />
1 2 3 5 7 8 16 20 25 61 </p>
<p>sorted elements1 2 3 5 7 8 16 20 25 61</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-programs-for-sorting-numbers-in-ascending-order-using-quick-sort-method/">C++ programs for sorting numbers in ascending order using Quick sort method</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-programs-for-sorting-numbers-in-ascending-order-using-quick-sort-method/feed/</wfw:commentRss>
			<slash:comments>23</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program that uses non-recursive functions to traverse a binary tree in Post-order</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-non-recursive-functions-to-traverse-a-binary-tree-in-post-order/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-non-recursive-functions-to-traverse-a-binary-tree-in-post-order/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 17:22:47 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[binary tree]]></category>
		<category><![CDATA[Post-order]]></category>
		<category><![CDATA[non-recursive functions]]></category>
		<category><![CDATA[tree]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1032</guid>

					<description><![CDATA[<p>/* Write C++ program that uses non-recursive functions to traverse a binary tree in Post-order */ #include #include #include class node { public: class node *left; class node *right; int data; }; class tree: public node { public: int stk[50],top; node *root; tree() { root=NULL; top=0; } void insert(int ch) { node *temp,*temp1; if(root== NULL)</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-non-recursive-functions-to-traverse-a-binary-tree-in-post-order/">C++ program that uses non-recursive functions to traverse a binary tree in Post-order</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ program that uses non-recursive functions to traverse a binary tree in Post-order */</p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>

class node
{
public:
class node *left;
class node *right;
int data;
};

class tree: public node
{
public:
int stk[50],top;
node *root;
tree()
{
root=NULL;
top=0;
}
void insert(int ch)
{
	node *temp,*temp1;
	if(root== NULL)
	{
		root=new node;
		root->data=ch;
		root->left=NULL;
		root->right=NULL;
		return;
	}
	temp1=new node;
	temp1->data=ch;
	temp1->right=temp1->left=NULL;
	temp=search(root,ch);
	if(temp->data>ch)
		temp->left=temp1;
	else
		temp->right=temp1;

}
node *search(node *temp,int ch)
{
	if(root== NULL)
	{
		cout <<"no node present";
		return NULL;
	}
	if(temp->left==NULL && temp->right== NULL)
		return temp;

	if(temp->data>ch)
	     {  if(temp->left==NULL) return temp;
		search(temp->left,ch);}
	else
	      { if(temp->right==NULL) return temp;
	      search(temp->right,ch);

}              }

void display(node *temp)
{
	if(temp==NULL)
	 return ;
	display(temp->left);
       cout<<temp->data << " ";
	display(temp->right);
}
void postorder( node *root)
{
	node *p;
	p=root;
	top=0;

	while(1)
	{
	while(p!=NULL)
	{
		stk[top]=p->data;
		top++;
		if(p->right!=NULL)
			stk[top++]=-p->right->data;
		p=p->left; 
	}
	while(stk[top-1] > 0 || top==0)
	{
	   if(top==0) return;
	   cout << stk[top-1] <<" ";
	   p=pop(root);
	}
	if(stk[top-1]<0)
	{
	  stk[top-1]=-stk[top-1];
	  p=pop(root);
      }	}

}
node * pop(node *p)
{
int ch;
ch=stk[top-1];
if(p->data==ch)
{
top--;
return p;
}
if(p->data>ch)
pop(p->left);
else
pop(p->right);
}
};
void main()
{
	tree t1;
	int ch,n,i;
	clrscr();
	while(1)
	{
		cout <<"\n1.INSERT\n2.DISPLAY 3.POSTORDER TRAVERSE\n4.EXIT\nEnter your choice:";
		cin >> ch;
		switch(ch)
		{
		case 1:   cout <<"enter no of elements to insert:";
			  cout<<"\n enter the elements";
			  cin >> n;
			  for(i=1;i<=n;i++)
			  {  cin >> ch;
			     t1.insert(ch);
			  }
			   break;
		case 2:   t1.display(t1.root);break;
		case 3:   t1.postorder(t1.root); break;
		case 4:   exit(1);
		}
	}
}

</pre>
<p><strong>OUTPUT</strong></p>
<p>1.INSERT<br />
2.DISPLAY 3.POSTORDER TRAVERSE<br />
4.EXIT<br />
Enter your choice:1<br />
enter no of elements to insert:<br />
 enter the elements7<br />
5 24 36 11 44 2 21</p>
<p>1.INSERT<br />
2.DISPLAY 3.POSTORDER TRAVERSE<br />
4.EXIT<br />
Enter your choice:2<br />
2 5 11 21 24 36 44</p>
<p>1.INSERT<br />
2.DISPLAY 3.POSTORDER TRAVERSE<br />
4.EXIT<br />
Enter your choice:3<br />
2 21 11 44 36 24 5</p>
<p>1.INSERT<br />
2.DISPLAY 3.POSTORDER TRAVERSE<br />
4.EXIT<br />
Enter your choice:4</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-non-recursive-functions-to-traverse-a-binary-tree-in-post-order/">C++ program that uses non-recursive functions to traverse a binary tree in Post-order</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-that-uses-non-recursive-functions-to-traverse-a-binary-tree-in-post-order/feed/</wfw:commentRss>
			<slash:comments>54</slash:comments>
		
		
			</item>
	</channel>
</rss>
