#include<iostream>
#include<cmath>
#include<complex>
#include<vector>
using namespace std;
vector<complex<double> > Compute_wn(int n);
int main()
{
Compute_wn(8);
return 0;
}
vector<complex<double> > Compute_wn(int n)
{
vector<complex<double> > V[n];
for(int i = 0; i<n; i++)
{
V[i] = complex<double>(cos(2.0*M_PI*double(i)/double(n)),sin(2.0*M_PI*double(i)/double(n)));
cout<<V[i]<<"\t";
}
cout<<"\n";
}
I am new to C++. When I compile this code the error I get is that error: no viable overloaded '='.
(V[i] = complex<double>(cos(2.0*M_PI*double(i)/double(n)),sin(2.0*M_PI*double(i)/double(n)));
) I don't understand how I need to overload the operator '=' for a vector of complex numbers of type double. As I understand that vector is a vector of complex numbers I should be able to directly assign to V[I].