<?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>C++ Programs | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/cpp-programs/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Fri, 12 Mar 2010 09:45:07 +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++ program for implementation of class</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 12 Mar 2010 09:45:07 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[class implementations]]></category>
		<category><![CDATA[c++ class]]></category>
		<category><![CDATA[C++ Programs]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Source Codes]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1044</guid>

					<description><![CDATA[<p>AIM: A program to solve a quadratic equation, using OOP techniques. ALGORITHM: 1) Start the process 2) Invoke the classes 3) Get the input for a,b,c; 4) Call the function getinfo() and display() 5) Check if a=0 a) True : compute c/b; i) Print the value of a/c; b) False: compute b*b-4*a*c; i) If (</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/">C++ program for implementation of class</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 solve a quadratic equation, using OOP techniques.</p>
<p><strong>ALGORITHM: </strong></p>
<p>1)	Start the process<br />
2)	Invoke the classes<br />
3)	Get the input for a,b,c;<br />
4)	Call the function getinfo() and display()<br />
5)	Check if a=0<br />
a)	True : compute c/b;<br />
i)	Print the value of a/c;<br />
b)	False: compute b*b-4*a*c;<br />
i)	If ( b*b-4*a*c)=0<br />
ii)	Call img();<br />
iii)	Otherwise : call real(a,b,c);<br />
6)	Stop the process</p>
<p><strong>PROGRAM:</strong></p>
<pre lang="cpp">
	#include<iostream.h>
	#include<conio.h>
		class equation
		{
			private:float a,b,c;
			public: void getinfo(float  a, float b,float c );
				void display( );
				void equal(float  a, float b);
				void imag( );
				void real(float a,float b,float c);
		};
		void  equation :: getinfo(float aa,float bb,float cc)
		{
	                a=aa;
			b=bb;
		        c=cc;
		}
		void equation::display( )
		{
			cout<<endl;
			cout<<”a=”<<a<<’\t’;
			cout<<”b=”<<b<<’\t’;
			cout<<”c=”<<c<<endl;
		}		

void equation ::equal (float a,float b)
		{
			float x;
			x = -b/(2*a);
			cout<<”Roots are equal “<<x<<endl;
		}
		void equation :: imag( )
		{
			cout<<”Roots are imaginary”;
		}
		void equation :: real(float a,float b,float det)
		{
			float x1,x2,temp;
			temp = sqrt(det);
			x1= (-b + temp)/(2*a);
			x2 = (-b –temp)/(2*a);
			cout<<”Roots are real”;
			cout<<”x1= “<<x1<<endl;
			cout<<”x2 =”<<x2<<endl;
		}
		void main( )
		{
			class equation e;
			float aa,bb,cc;
			clrscr( );
			cout<<”Enter the three numbers”;
			cin>>aa>>bb>>cc;
			e.getinfo(aa,bb,cc);
			e.display( );
			if(aa = =0)
			{
				float temp;
				temp = cc/bb;
				cout<<” Linear Roots”<<temp<<endl;
			}
			else
			{
				float det;
				det = (bb*bb – 4*aa*cc);
				if(det = =0)
				e.equal(aa,bb);
				else if (det<0 )
				          e.imag( );
				else 
				          e.real(aa,bb,cc );
			}
			getch( );
		}	
</pre>
<p><strong>OUTPUT:</strong><br />
	Enter the three numbers 2 4 1<br />
	Roots are imaginary<br />
	X1= - 0.292893<br />
	X2= - 1.707107</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/">C++ program for implementation of class</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-implementation-of-class/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement the Queue ADT using a single linked list</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-queue-adt-using-a-single-linked-list/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-queue-adt-using-a-single-linked-list/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 14:05:19 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C++ Programs]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[linked list]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1013</guid>

					<description><![CDATA[<p>/* Write C++ programs to implement the Queue ADT using a singly linked list */ #include #include #include using namespace std; class node { public: class node *next; int data; }; class queue : public node { node *head; int front,rare; public: queue() { front=-1; rare=-1; } void push(int x) { if (rare < 0
</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-queue-adt-using-a-single-linked-list/">C++ program to implement the Queue ADT using a single linked list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ programs to implement the Queue ADT using a singly linked list */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class node
{
      public:
             class node *next;
             int data;
};

class queue : public node
{
            node *head;
            int front,rare;
	public:
           queue()
           	{
            	front=-1;
             	rare=-1;
             }
           void push(int x)
           	{
            	if (rare < 0 )
             		{
               			head =new node;
                  		head->next=NULL;
                    	head->data=x;
                     	rare ++;
                     }
             else
                    {
                    	node *temp,*temp1;
                     	temp=head;
                      	if(rare >= 4)
                          {
                          	cout <<"queue over flow";
                           	return;
                           }
                        rare++;
                        while(temp->next != NULL)
                        	temp=temp->next;
                        temp1=new node;
                        temp->next=temp1;
                        temp1->next=NULL;
                        temp1->data=x;
                    }  }

           void display()
           	{
              node *temp;
              temp=head;
              if (rare < 0)
                {
                    cout <<" queue under flow";
                    return;
                 }
              while(temp != NULL)
               {
               	   cout <<temp->data<< " ";
                   temp=temp->next;
                }
             }
             void pop()
              {
              	node *temp;
               	temp=head;
                if( rare < 0)
                  {
                  	cout <<"queue under flow";
                   	return;
                   }
                if(front == rare)
                  {
                  	front = rare =-1;
                   	head=NULL;
                    return;
                   }
                front++;
                head=head->next;
                }
};
main()
{
	queue s1;
	int ch;
	while(1)
      {
		cout <<"\n1.PUSH\n2.POP\n3.DISPLAY\n4.EXIT\n enter ru choice:";
		cin >> ch;
		switch(ch)
		{
            case 1:
                 	cout <<"\n enter a element";
                  	cin >> ch;
                   	s1.push(ch); break;

            case 2: s1.pop();break;
            case 3: s1.display();break;
        	case 4: exit(0);
		  }
       }
return (0);
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:1<br />
 enter a element23</p>
<p>1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:1<br />
 enter a element54</p>
<p>1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:3<br />
23 54<br />
1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:2</p>
<p>1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:2</p>
<p>1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:2<br />
queue under flow<br />
1.PUSH 2.POP 3.DISPLAY 4.EXIT<br />
 enter ru choice:4</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-queue-adt-using-a-single-linked-list/">C++ program to implement the Queue ADT using a single linked 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-data-structure/c-program-to-implement-the-queue-adt-using-a-single-linked-list/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to perform Insert, Delete, Search an element into a binary search tree</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-perform-insert-delete-search-an-element-into-a-binary-search-tree/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-perform-insert-delete-search-an-element-into-a-binary-search-tree/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 10 Mar 2010 15:14:15 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C++ Programs]]></category>
		<category><![CDATA[binary tree]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Delete]]></category>
		<category><![CDATA[Insert]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=995</guid>

					<description><![CDATA[<p>/* Write a C++ program to perform the following operations:<br />
a) Insert an element into a binary search tree.<br />
b) Delete an element from a binary search tree.<br />
c) Search for a key element in a binary search tree. */</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-perform-insert-delete-search-an-element-into-a-binary-search-tree/">C++ program to perform Insert, Delete, Search an element into a binary search tree</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write a C++ Data structure program to perform the following operations:<br />
a) Insert an element into a binary search tree.<br />
b) Delete an element from a binary search tree.<br />
c) for a key element in a binary search tree. */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;

void insert(int,int );
void delte(int);
void display(int);
int search(int);
int search1(int,int);
int tree[40],t=1,s,x,i;

main()
{
	int ch,y;
	for(i=1;i<40;i++)
	tree[i]=-1;
	while(1)
	{
cout <<"1.INSERT\n2.DELETE\n3.DISPLAY\n4.SEARCH\n5.EXIT\nEnter your choice:";
		cin >> ch;
		switch(ch)
		{
		case 1:
			cout <<"enter the element to insert";
			cin >> ch;
			insert(1,ch);
			break;
		case 2:
			cout <<"enter the element to delete";
			cin >>x;
			y=search(1);
			if(y!=-1) delte(y);
			else cout<<"no such element in tree";
			break;
		case 3:
			display(1);
			cout<<"\n";
			for(int i=0;i<=32;i++)
			cout <<i;
			cout <<"\n";
			break;
case 4:
			cout <<"enter the element to search:";
			cin >> x;
			y=search(1);
			if(y == -1) cout <<"no such element in tree";
			else cout <<x << "is in" <<y <<"position";
			break;
		case 5:
			exit(0);
		}
	}
}

void insert(int s,int ch )
{
	int x;
	if(t==1)
	{
		tree[t++]=ch;
		return;
	}
	x=search1(s,ch);
	if(tree[x]>ch)
		tree[2*x]=ch;
	else
		tree[2*x+1]=ch;
	t++;
}
void delte(int x)
{
	if( tree[2*x]==-1 && tree[2*x+1]==-1)
		tree[x]=-1;
	else if(tree[2*x]==-1)
	      {	tree[x]=tree[2*x+1];
		tree[2*x+1]=-1;
	      }
	else if(tree[2*x+1]==-1)
	      {	tree[x]=tree[2*x];
		tree[2*x]=-1;
	      }
	else
	{
	  tree[x]=tree[2*x];
	  delte(2*x);
	}
	t--;
}

int search(int s)
{
if(t==1)
{
cout <<"no element in tree";
return -1;
}
if(tree[s]==-1)
return tree[s];
if(tree[s]>x)
search(2*s);
else if(tree[s]<x)
search(2*s+1);
else
return s;
}

void display(int s)
{
if(t==1)
{cout <<"no element in tree:";
return;}
for(int i=1;i<40;i++)
if(tree[i]==-1)
cout <<" ";
else cout <<tree[i];
return ;
}

int search1(int s,int ch)
{
if(t==1)
{
cout <<"no element in tree";
return -1;
}
if(tree[s]==-1)
return s/2;
if(tree[s] > ch)
search1(2*s,ch);
else search1(2*s+1,ch);
}
</pre>
<p><strong>OUTPUT</strong><br />
1.INSERT<br />
2.DELETE<br />
3.DISPLAY<br />
4.SEARCH<br />
5.EXIT<br />
Enter your choice:3</p>
<p>no element in tree:<br />
0123456789011121314151617181920212223242526272829303132</p>
<p>1.INSERT<br />
2.DELETE<br />
3.DISPLAY<br />
4.SEARCH<br />
5.EXIT<br />
Enter your choice:1</p>
<p>Enter the element to insert 10<br />
1.INSERT<br />
2.DELETE<br />
3.DISPLAY<br />
4.SEARCH<br />
5.EXIT<br />
Enter your choice:4</p>
<p>Enter the element to search: 10<br />
10 is in 1 position<br />
1.INSERT<br />
2.DELETE<br />
3.DISPLAY<br />
4.SEARCH<br />
5.EXIT</p>
<p>Enter your choice:5</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-perform-insert-delete-search-an-element-into-a-binary-search-tree/">C++ program to perform Insert, Delete, Search an element into a binary search tree</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-to-perform-insert-delete-search-an-element-into-a-binary-search-tree/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
