//PROGRAM:
#include<iostream>
#include<conio.h>
using namespace std;
class complex {
private:
double re, img;
public:
complex();
void input();
complex SubCom(complex c1, complex c2);
complex SumCom(complex c1, complex c2);
complex MulCom(complex c1, complex c2);
void show();
};
complex::complex() {
re = 0;
img = 0;
}
void complex::input() {
cout << "Real:";
cin >> re;
cout << "Imagnary:";
cin >> img;
}
complex complex::SumCom(complex c1, complex c2) {
re = c1.re + c2.re;
img = c1.img + c2.img;
}
complex complex::SubCom(complex c1, complex c2) {
re = c1.re - c2.re;
img = c1.img - c2.img;
}
complex complex::MulCom(complex c1, complex c2)
{
re = c1.re * c2.re;
img = c1.img*c2.img;
}
void complex::show() {
cout << re << "," << img << "i";
}
int main() {
complex c1;
c1.input();
c1.show();
complex c2;
c2.input();
c2.show();
complex c;
c.SumCom(c1, c2);
c.show();
c.MulCom(c1, c2);
c.show();
c.SubCom(c1, c2);
c.show();
_getch();
return 0;
system("pause");
}
Hello, I have made a program which takes to integers from the user using a function which is a class member. I have made 3 member functions for sum, product and difference. now the error is showing which says that
1. complex::SumCom must return a value
2. complex::MulCom must return a value
3. complex::SubCom must return a value.