5
I’m new to C++ and would like to know how to use complex numbers:
double real[2]={2,5};
double imaginario[2]{7,9};
cout << "Soma: " << real[0]+real[1] << "+" << imaginario[0]+imaginario[1] << "i";
Is there a library for this?
5
I’m new to C++ and would like to know how to use complex numbers:
double real[2]={2,5};
double imaginario[2]{7,9};
cout << "Soma: " << real[0]+real[1] << "+" << imaginario[0]+imaginario[1] << "i";
Is there a library for this?
7
There is yes:
#include <iostream>
#include <complex>
using namespace std;
int main(){
complex<double> a={2,7}, b={5,9};
cout << "Soma: " << a+b;
}
Browser other questions tagged c++ mathematics
You are not signed in. Login or sign up in order to post.