complex number plus another complex number : Complex « Data Type « C++






complex number plus another complex number

  
#include <iostream>
#include <complex>
using namespace std;
   
int main()
{
  complex<double> cmpx1(1, 0);
  complex<double> cmpx2(1, 1);
   
  cout << cmpx1 << " " << cmpx2 << endl;
   
  complex<double> cmpx3 = cmpx1 + cmpx2;
  cout << cmpx3 << endl;
   
  cmpx3 += 10;
  cout << cmpx3 << endl;
   
  return 0;
}
  
    
  








Related examples in the same category

1.Demonstrate complex.Demonstrate complex.
2.Demonstrate the complex class.