//call_complx.cpp
#include "complx.h"
ifstream infile ("in.dat");
int main()
{
int i=0;
complx in[7];
double d = 4.5;
cout<< "The input numbers are: " << endl;
while (infile >> in[i]){
cout << in[i] << endl;
i++;
}
complx s1 = in[0] + in[1]; // calls complx::operator+()
complx s2 = d + in[2]; // overload operator+()
complx s3 = in[3] + d; // overload operator+()
complx a = in[4] - in[5];
complx mm=in[3]*in[4];
complx dm=d*in[4] ;
complx b=d-in[0] ;
cout << "The sum is a complex number " << s1 <<endl;
cout << "The sum is a complex number " << s2 <<endl;
cout << "The sum is a complex number " << s3 <<endl;
cout << "The subtract is a complex number " << a <<endl;
cout << "The product is a complex number " << mm <<endl;
cout << "The subtract is a complex number " << b <<endl;
cout << "The product is a complex number " << dm <<endl;
if (in[4] == in[5]) cout << "in[4] and in[5] are the same " << endl;
system("pause");
return 0; //successful termination
//call_complx.cpp
#include "complx.h"
ifstream infile ("in.dat");
int main()
{
int i=0;
complx in[7];
double d = 4.5;
cout<< "The input numbers are: " << endl;
while (infile >> in[i]){
cout << in[i] << endl;
i++;
}
complx s1 = in[0] + in[1]; // calls complx::operator+()
complx s2 = d + in[2]; // overload operator+()
complx s3 = in[3] + d; // overload operator+()
complx a = in[4] - in[5];
complx mm=in[3]*in[4];
complx dm=d*in[4] ;
complx b=d-in[0] ;
cout << "The sum is a complex number " << s1 <<endl;
cout << "The sum is a complex number " << s2 <<endl;
cout << "The sum is a complex number " << s3 <<endl;
cout << "The subtract is a complex number " << a <<endl;
cout << "The product is a complex number " << mm <<endl;
cout << "The subtract is a complex number " << b <<endl;
cout << "The product is a complex number " << dm <<endl;
if (in[4] == in[5]) cout << "in[4] and in[5] are the same " << endl;
system("pause");
return 0; //successful termination