Added a demonstration

This commit is contained in:
Gahjouyooj
2023-04-19 19:33:07 +08:00
parent bcca2fb737
commit ff88511025

View File

@@ -8,9 +8,12 @@
*/
#include <array>
#include <cassert>
#include <cmath>
#include <complex>
#include <exception>
#include <iomanip>
#include <iostream>
/// @brief Quadratic equation calculator.
/// @param a quadratic coefficient.
@@ -71,3 +74,14 @@ std::array<std::complex<long double>, 2> quadraticEquation(long double a,
return solutions;
}
int main() {
std::array<std::complex<long double>, 2> aaa = quadraticEquation(1, 1, 1);
std::cout << "The complex roots of x^2 + x + 1 are " << aaa[0] << " and "
<< aaa[1]
<< ".\nMore precisely, and with the inaccuracy of floating point "
"numbers, "
<< std::setprecision(100) << aaa[0] << " and " << aaa[1] << "\n";
return 0;
}