<?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>operator overloading | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/operator-overloading/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 14:04: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 complex arithmetic using operator overloading</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 04 Apr 2010 14:04:26 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[operator overloading]]></category>
		<category><![CDATA[complex numbers]]></category>
		<category><![CDATA[complex arithmetic]]></category>
		<category><![CDATA[c++ complex]]></category>
		<category><![CDATA[add complex numbers]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1142</guid>

					<description><![CDATA[<p>Write a program to perform complex arithmetic using operator overloading #include #include #include #include class complex { int real; float image; public: void getdata() { coutreal; coutimage; } void operator + (complex); void operator - (complex); }; void complex :: operator + (complex c1) { complex temp; temp.real=real+c1.real; temp.image=image+c1.image; if (temp.image>=0); { cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/">C++ class program to perform complex arithmetic using operator overloading</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a program to perform complex arithmetic using operator overloading</p>
<pre lang="cpp">
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<process.h>
class complex
{
	int real;
	float image;
	public:
	void getdata()
	{
		cout<<"\n enter the real part of the complex";
		cin>>real;
		cout<<"\n enter the imaginary part of the complex";
		cin>>image;
	}
	void operator + (complex);
	void operator - (complex);
};

void complex :: operator +  (complex c1)
{
	complex temp;
	temp.real=real+c1.real;
	temp.image=image+c1.image;
	if (temp.image>=0);
	{
		cout<<"\n complex no. after addition:";
		cout<<temp.real<<"+"<<temp.image<<"i";
	}
	else
	{
		cout<<"\n complex no. after addition ";
		cout<<temp.real<<temp.image<<"i";
	}
}
void complex ::operator-(complex c1)
{
	complex temp;
	temp.real = real-c1.image;
	temp.image= image-c1.image;
	if (temp.image>=0)
	{
		cout<<"\n complex no. after subtraction";
		cout<<"\n temp.real<<"+"<<temp.image<<"i";
	}
	else
	{
		cout<<"\n complex no. after subtraction";
		cout<<temp.real<<temp.image<<"i"
	}
}
void main()
{
	clrscr();
	comp.ex c1, c2;
	int n;
	do 
	{
		cout<<"\n 1. Input data for complex no. ";
		cout<<"\n 2. Addition of complex no. ";
		cout<<"\n 3. Subtraction of complex no. ";
		cout<<"\n 4. Quit";
		cout<<"\n Enter your choice";
		cin>>n;
		switch(n)

		{ 
			 case1:
			 cout<<endl<<"\n Enter the data for First Complex No......";
			 cl.getdata();
			 cout<<endl<<"\n Enter the data for seconds Complex No.....";
			 c2.getdata();
			 clrscr();
			 break;
			 
			 case 2;
			 cl+c2;
			 getch();
			 clrscr();
			 break;
			 
			 case 3:
			 cl-c2;
			 getch();
			 clrscr();
			 brak;

			 case 4:
			 exit91);
			 break;
			}
		} while (n!=4);
     getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-class-program-to-perform-complex-arithmetic-using-operator-overloading/">C++ class program to perform complex arithmetic using operator overloading</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-complex-arithmetic-using-operator-overloading/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to perform arithmetic operations of two complex numbers using operator overloading</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-perform-arithmetic-operations-of-two-complex-numbers-using-operator-overloading/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-perform-arithmetic-operations-of-two-complex-numbers-using-operator-overloading/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 13:15:11 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[c++ overloading]]></category>
		<category><![CDATA[operator overloading]]></category>
		<category><![CDATA[complex numbers]]></category>
		<category><![CDATA[operations]]></category>
		<category><![CDATA[Binary operator]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1054</guid>

					<description><![CDATA[<p>BINARY OPERATOR AIM: A program to perform simple arithmetic operations of two complex numbers using operator overloading. ALGORITHAM: • Start the process • Get the complex value a.real and a.image • Check while ((ch=getchar())!=’q’) o True : execute switch(ch) o Case ‘a’:Then Compute cb.imag; menu(); while ((ch = getchar()) != 'q') { switch(ch) { case</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-perform-arithmetic-operations-of-two-complex-numbers-using-operator-overloading/">C++ program to perform arithmetic operations of two complex numbers using operator overloading</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>BINARY OPERATOR</strong></p>
<p>AIM:<br />
A program to perform simple arithmetic operations of two complex numbers using operator overloading.</p>
<p><strong>ALGORITHAM: </strong></p>
<p>•	Start the process<br />
•	Get the complex value a.real and a.image<br />
•	Check while ((ch=getchar())!=’q’)<br />
o	True : execute switch(ch)<br />
o	Case ‘a’:Then<br />
Compute c<-a+b, Print c.real and c.imag
o	Case ‘s’: Then
Compute c<-a-b, Print c.real and c.imag
o	Case ‘m’: Then
Compute c<-a*b, Print c.real and c.imag
o	Case ‘d’: Then
Compute c<-a/b, Print c.real and c.imag
o	End of switch
•	End of while
•	Stop the process

<strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct complex
{
float real;
float imag;
};
complex operator + (complex a,complex b);
complex operator - (complex a,complex b);
complex operator * (complex a,complex b);
complex operator / (complex a,complex b);

void main()
{
complex a,b,c;
int ch;
void menu(void);clrscr();
cout<<"Enter the first complex no:";
cin>>a.real>>a.imag;
cout<<"Enter the second complex no:";
cin>>b.real>>b.imag;
menu();
while ((ch = getchar()) != 'q')
{
switch(ch)
{
case 'a':c =a + b;
cout<<"Addition of 2 no’s";
cout<<c.real<<"+i"<<c.imag;
break;
case 's':c=a-b;
cout<<"Substraction of 2 no’s";
cout<<c.real<<"i"<<c.imag;
break;
case 'm':c=a*b;
cout<<"Multiplication of 2 no’s";
cout<<c.real<<"i"<<c.imag;
break;
 				case 'd':c=a/b;
cout<<"Division of 2 no’s";
cout<<c.real<<"i"<<c.imag;
break;
 			}
 		}
 	}
 	void menu()
{
cout<<"complex no: operators";
cout<<"a->addition";
cout<<"s->substraction";
cout<<"m->multiplication";
cout<<"d->division";
cout<<"q->quit";
cout<<"options please";
}
complex operator -(struct complex a, struct complex b)
{
complex c;
c.real=a.real-b.real;
c.imag=a.imag-b.imag;
return(c);
}
complex operator *(struct complex a, struct complex b)
{
complex c;
c.real=((a.real*b.real)-(a.imag*b.imag));
c.imag=((a.real*b.imag)+(a.imag*b.real));
return(c);
}
complex operator +(struct complex a,struct complex b)
{
complex c;
c.real=a.real+b.real;
c.imag=a.imag+b.imag;
return(c);
}
complex operator /(struct complex a, struct complex b)
{
complex c;
float temp;
temp=((b.real*b.real)+(b.imag*b.imag));
c.real=((a.real*b.real)+(a.imag*b.imag))/temp;
  		 return(c);
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>Enter the first complex no: 1,1<br />
Enter the second complex no: 2,2</p>
<p>Addition of 2 no’s :   3+I3</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-perform-arithmetic-operations-of-two-complex-numbers-using-operator-overloading/">C++ program to perform arithmetic operations of two complex numbers using operator overloading</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-perform-arithmetic-operations-of-two-complex-numbers-using-operator-overloading/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
	</channel>
</rss>
