This commit is contained in:
RafayAhmad7548 2024-06-16 18:53:25 +05:00
parent 37776af5db
commit ab03d5f10c
4045 changed files with 286212 additions and 3 deletions

View file

@ -0,0 +1,59 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int getReal(){
return real;
}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
// res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
return a + c.getReal();
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, const Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c){
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,65 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
friend Complex operator++(Complex &c){
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
Complex operator++(Complex& c){
c.real++;
c.img++;
return c;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,50 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,58 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,44 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, const Complex);
};
ostream& operator<<(ostream& out, const Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,41 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator++(Complex &c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, const Complex);
};
ostream& operator<<(ostream& out, const Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, const Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,48 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
Complex c3 = c1 + c2 + c4;
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,60 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
real++;
img++;
return *this;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
real--;
img--;
return *this;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,59 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int getReal(){
return real;
}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
return a + c.getReal();
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
Complex c3 = c1 + c2 + c4;
// int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,63 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
friend Complex operator++(Complex &c){}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
Complex operator++(Complex& c){
c.real++;
c.img++;
return c;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,67 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,48 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
Complex c3 = c1 + c2;
return 0;
}

View file

@ -0,0 +1,62 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,60 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
return *this;
real++;
img++;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
real--;
img--;
return *this;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,55 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
return a + c.real;
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,52 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,50 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,59 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int getReal(){
return real;
}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
// res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
return a + c.getReal();
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,59 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int getReal(){
return real;
}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
return a + c.getReal();
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,50 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,47 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
cout<<c1;
return 0;
}

View file

@ -0,0 +1,55 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
int operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res.real;
}
friend ostream& operator<<(ostream&, Complex&);
};
int operator+(int a, Complex c){
}
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
// Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
cout<<c1;
return 0;
}

View file

@ -0,0 +1,37 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,50 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
Complex c3 = c1 + c2 + c4;
int c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,44 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real;
out<<"Real Part: "<<c.real;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,44 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real;
out<<"Real Part: "<<c.img;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c){
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Untitled-1.cpp","entries":[{"id":"MZf2.cpp","timestamp":1711428527095},{"id":"GGA4.cpp","timestamp":1711428544410},{"id":"je48.cpp","timestamp":1711428663767},{"id":"LuKu.cpp","timestamp":1711428706516},{"id":"JoRl.cpp","timestamp":1711428830112},{"id":"eR6N.cpp","timestamp":1711428864910},{"id":"2KuS.cpp","timestamp":1711428935788},{"id":"vGW1.cpp","timestamp":1711428952962},{"id":"fQ2R.cpp","timestamp":1711429235320},{"id":"vLVu.cpp","timestamp":1711429279810},{"id":"qDbD.cpp","timestamp":1711429303510},{"id":"50Xs.cpp","timestamp":1711429342954},{"id":"JjVT.cpp","timestamp":1711429381524},{"id":"oHMq.cpp","timestamp":1711429482590},{"id":"Cby0.cpp","timestamp":1711429511760},{"id":"6yP9.cpp","timestamp":1711429536487},{"id":"mShu.cpp","timestamp":1711429663500},{"id":"lpTN.cpp","timestamp":1711429681253},{"id":"wss7.cpp","timestamp":1711429694826},{"id":"A1Oh.cpp","timestamp":1711600360807},{"id":"ytN6.cpp","timestamp":1711600372169},{"id":"WA3W.cpp","timestamp":1711600391778},{"id":"a2lR.cpp","timestamp":1711600493890},{"id":"bH6b.cpp","timestamp":1711600545827},{"id":"7TPo.cpp","timestamp":1711600558060},{"id":"lwSd.cpp","timestamp":1711600654335},{"id":"4aqs.cpp","timestamp":1711600666747},{"id":"DD8E.cpp","timestamp":1711600696414},{"id":"0HVy.cpp","timestamp":1711600730623},{"id":"9Q03.cpp","timestamp":1711600761809},{"id":"BJQh.cpp","timestamp":1711600803437},{"id":"quUX.cpp","timestamp":1711600852247},{"id":"G0P3.cpp","timestamp":1711600863738},{"id":"UWa7.cpp","timestamp":1711600876773},{"id":"kFrd.cpp","timestamp":1711600993010},{"id":"TLu3.cpp","timestamp":1711601149904},{"id":"KcUu.cpp","timestamp":1711601175858},{"id":"FiOr.cpp","timestamp":1711601188353},{"id":"ndeV.cpp","timestamp":1711601200842},{"id":"YetN.cpp","timestamp":1711601311970},{"id":"THab.cpp","timestamp":1711601370681},{"id":"PFJb.cpp","timestamp":1711601388316},{"id":"6Eq8.cpp","timestamp":1711601456597},{"id":"NkEo.cpp","timestamp":1711601488287},{"id":"UU5h.cpp","timestamp":1711601530867},{"id":"NHr3.cpp","timestamp":1711601553888},{"id":"RT7H.cpp","timestamp":1711601589329},{"id":"07LV.cpp","timestamp":1711601613996},{"id":"RMJJ.cpp","timestamp":1711601735672},{"id":"HYmA.cpp","timestamp":1711616456669}]}

View file

@ -0,0 +1,67 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
Complex operator++(Complex const& c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,61 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
real--;
img--;
return *this;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,42 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
cout<<c1;
return 0;
}

View file

@ -0,0 +1,66 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
// setter
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator++(Complex &c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, Complex);
};
ostream& operator<<(ostream& out, Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,62 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator++(Complex &c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,49 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator+(Complex c){
Complex res;
res.real = real + c.real;
res.img = img + c.img;
return res;
}
friend ostream& operator<<(ostream&, Complex&);
};
ostream& operator<<(ostream& out, Complex& c){
out<<c.real<<"+"<<c.img<<"i\n";
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c4(2, 3);
Complex c3 = c1 + c2 + c4;
cout<<c3;
return 0;
}

View file

@ -0,0 +1,53 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
friend Complex operator++(Complex &c){}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
Complex operator+(Complex const& c1, Complex const& c2){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,65 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
friend Complex operator++(Complex const &c){
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
Complex operator++(Complex const& c){
c.real++;
c.img++;
return *this;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
friend ostream& operator<<(ostream&, const Complex&);
};
ostream& operator<<(ostream& out, const Complex& c){
out<<"Real Part: "<<c.real<<endl;
out<<"Imaginary Part: "<<c.img<<endl;
return out;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,63 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
friend Complex operator++(Complex const &c){
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
friend Complex operator+(Complex const& c1, Complex const& c2){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator+(Complex const& c1, Complex const& c2){
Complex res;
res.real = c1.real + c2.real;
res.img = c1.img + c2.img;
return res;
}
Complex operator++(Complex const& c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,66 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
// setter
Complex operator++(int){
Complex temp(*this);
real++;
img++;
return temp;
}
Complex operator++(){
real++;
img++;
return *this;
}
Complex operator--(int){
Complex temp(*this);
real--;
img--;
return temp;
}
Complex operator--(){
real--;
img--;
return *this;
}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator++(Complex &c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
Complex c3 = c1++;
c1.print();
c3.print();
return 0;
}

View file

@ -0,0 +1,41 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Complex{
int real;
int img;
public:
Complex(){}
Complex(int real, int img) : real(real), img(img){}
void print(){
cout<<real<<" + i"<<img<<endl;
}
};
Complex operator++(Complex &c){
}
int main(){
Complex c1(1, 2);
Complex c2(2, 3);
return 0;
}