- #1
FrostScYthe
- 80
- 0
Hey, I'm having trouble with this program
This is the code:
#include <complex>
#include <iostream>
using namespace std;
using std::complex;
int main ()
{
complex <double> c1; // complex numbers with double components
complex <double> c2;
cout << "Type in a complex number: ";
cin >> c1;
c1 *= 2;
cout << "|c1*2| = " << cabs(c1) << endl;
cin.get();
cin.get();
return 0;
}
however it doesn't seem to recognize any of the complex functions.. I don't know why... ? I get this error
14 C:\Dev-Cpp\main23.cpp no matching function for call to `cabs(std::complex<double>&)'
This is the code:
#include <complex>
#include <iostream>
using namespace std;
using std::complex;
int main ()
{
complex <double> c1; // complex numbers with double components
complex <double> c2;
cout << "Type in a complex number: ";
cin >> c1;
c1 *= 2;
cout << "|c1*2| = " << cabs(c1) << endl;
cin.get();
cin.get();
return 0;
}
however it doesn't seem to recognize any of the complex functions.. I don't know why... ? I get this error
14 C:\Dev-Cpp\main23.cpp no matching function for call to `cabs(std::complex<double>&)'