Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
13 views
2 pages
Oop Assignment1
111111111
Uploaded by
Swami Wardule
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download now
Download
Save oop_assignment1 For Later
Download
Save
Save oop_assignment1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
13 views
2 pages
Oop Assignment1
111111111
Uploaded by
Swami Wardule
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download now
Download
Save oop_assignment1 For Later
Carousel Previous
Carousel Next
Download
Save
Save oop_assignment1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 2
Search
Fullscreen
#include<iostream>
using namespace std;
class complex
{
float x;
float y;
public:
complex()
{
x=0;
y=0;
}
complex operator+(complex);
complex operator*(complex);
friend istream &operator >>(istream &input,complex &t)
{
cout<<"Enter the real part:";
input>>t.x;
cout<<"Enter the imaginary part:";
input>>t.y;
}
friend ostream &operator <<(ostream &output,complex &t)
{
output<<t.x<<"+"<<t.y<<"i\n";
}
};
complex complex::operator+(complex c)
{
complex temp;
temp.x=x+c.x;
temp.y=y+c.y;
return(temp);
}
complex complex::operator*(complex c)
{
complex temp2;
temp2.x=(x*c.x)-(y*c.y);
temp2.y=(y*c.x)+(x*c.y);
return (temp2);
}
int main()
{
complex c1,c2,c3,c4;
cout<<"Default constructor value=\n";
cout<<c1;
cout<<"\nEnter the 1st number\n";
cin>>c1;
cout<<"\nEnter the 2nd number\n";
cin>>c2;
c3=c1+c2;
c4=c1*c2;
cout<<"\nThe first number is ";
cout<<c1;
cout<<"\nThe second number is ";
cout<<c2;
cout<<"\nThe addition is ";
cout<<c3;
cout<<"\nThe multiplication is ";
cout<<c4;
return 0;
}
You might also like
OOPp1
PDF
No ratings yet
OOPp1
3 pages
Oop 01
PDF
No ratings yet
Oop 01
3 pages
OOOP1
PDF
No ratings yet
OOOP1
2 pages
Experiment No 3
PDF
No ratings yet
Experiment No 3
6 pages
Complex Number (1)
PDF
No ratings yet
Complex Number (1)
4 pages
Practical No 1
PDF
No ratings yet
Practical No 1
2 pages
Second
PDF
No ratings yet
Second
2 pages
Oops Practicals 1
PDF
No ratings yet
Oops Practicals 1
6 pages
Lab 1 TASK3
PDF
No ratings yet
Lab 1 TASK3
2 pages
Pract 1
PDF
No ratings yet
Pract 1
2 pages
Expt 5 Printout
PDF
No ratings yet
Expt 5 Printout
3 pages
20011598-136.. Quiz 02 Oop
PDF
No ratings yet
20011598-136.. Quiz 02 Oop
5 pages
Complex Overloading
PDF
No ratings yet
Complex Overloading
2 pages
complex program
PDF
No ratings yet
complex program
2 pages
Rohini Pract 1.cpp
PDF
No ratings yet
Rohini Pract 1.cpp
2 pages
COMPLEX NUMBER PROGRAM
PDF
No ratings yet
COMPLEX NUMBER PROGRAM
7 pages
Impt Docs
PDF
No ratings yet
Impt Docs
6 pages
CPP 3
PDF
No ratings yet
CPP 3
5 pages
Expt 5 Printout
PDF
No ratings yet
Expt 5 Printout
3 pages
Cpp Program 1
PDF
No ratings yet
Cpp Program 1
3 pages
Addition of Two Complex Numbers
PDF
No ratings yet
Addition of Two Complex Numbers
4 pages
class_complex_1
PDF
No ratings yet
class_complex_1
3 pages
Primer 5
PDF
No ratings yet
Primer 5
3 pages
Assignment No 3 New
PDF
No ratings yet
Assignment No 3 New
5 pages
Ans 1
PDF
No ratings yet
Ans 1
2 pages
kshitija tej
PDF
No ratings yet
kshitija tej
2 pages
Practical No.01 OOP
PDF
No ratings yet
Practical No.01 OOP
3 pages
OOP Pr 3(Complex)
PDF
No ratings yet
OOP Pr 3(Complex)
3 pages
OOP_Exp3
PDF
No ratings yet
OOP_Exp3
3 pages
Scientific Calculator Project Using C++
PDF
100% (1)
Scientific Calculator Project Using C++
7 pages
Syed Shams Haider 203 Lab Report 11
PDF
No ratings yet
Syed Shams Haider 203 Lab Report 11
22 pages
Pratical Assignment No 3 Oops Prinout
PDF
No ratings yet
Pratical Assignment No 3 Oops Prinout
4 pages
Lab 9-14
PDF
No ratings yet
Lab 9-14
52 pages
Class
PDF
No ratings yet
Class
4 pages
sajid ali
PDF
No ratings yet
sajid ali
2 pages
Calculator Assignment by Afaq 23204
PDF
No ratings yet
Calculator Assignment by Afaq 23204
6 pages
Assignment No: 9: Program Statement
PDF
No ratings yet
Assignment No: 9: Program Statement
5 pages
k242016
PDF
No ratings yet
k242016
5 pages
AKSH Cpp Assignemnt
PDF
No ratings yet
AKSH Cpp Assignemnt
5 pages
OOP Prem
PDF
No ratings yet
OOP Prem
25 pages
A3
PDF
No ratings yet
A3
2 pages
c++ prog
PDF
No ratings yet
c++ prog
6 pages
Sree Muthukumaraswamy College: Department of Bca Object Oriented Programming Using C++ Lab
PDF
No ratings yet
Sree Muthukumaraswamy College: Department of Bca Object Oriented Programming Using C++ Lab
61 pages
C++ Complex Numbers by Passing Structure
PDF
No ratings yet
C++ Complex Numbers by Passing Structure
1 page
Operator Overloading.cpp
PDF
No ratings yet
Operator Overloading.cpp
3 pages
oops_journal[1]
PDF
No ratings yet
oops_journal[1]
22 pages
function c+++
PDF
No ratings yet
function c+++
8 pages
Document
PDF
No ratings yet
Document
68 pages
1 C++Answer
PDF
No ratings yet
1 C++Answer
9 pages
DOC-20231103-WA0038.
PDF
No ratings yet
DOC-20231103-WA0038.
12 pages
Functions - Java - Object Oriented Programming
PDF
No ratings yet
Functions - Java - Object Oriented Programming
46 pages
Scientific Calculator
PDF
100% (1)
Scientific Calculator
13 pages
NILESH5_22410079
PDF
No ratings yet
NILESH5_22410079
3 pages
Name - Shivam Kumar Roll No. - 18115076 Assignment No. - 3
PDF
No ratings yet
Name - Shivam Kumar Roll No. - 18115076 Assignment No. - 3
7 pages
Expt 3 Printout
PDF
No ratings yet
Expt 3 Printout
2 pages
cpp program 1,2
PDF
No ratings yet
cpp program 1,2
6 pages
hello help
PDF
No ratings yet
hello help
7 pages
code2pdf_675c5a2b08f34
PDF
No ratings yet
code2pdf_675c5a2b08f34
3 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
150+ C Pattern Programs
From Everand
150+ C Pattern Programs
Hernando Abella
No ratings yet