From ff88511025bd95ca7e9c83754e3848552d77d719 Mon Sep 17 00:00:00 2001 From: Gahjouyooj Date: Wed, 19 Apr 2023 19:33:07 +0800 Subject: [PATCH] Added a demonstration --- math/quadratic_equations_complex_numbers.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/math/quadratic_equations_complex_numbers.cpp b/math/quadratic_equations_complex_numbers.cpp index f6f0098d3..89296a698 100644 --- a/math/quadratic_equations_complex_numbers.cpp +++ b/math/quadratic_equations_complex_numbers.cpp @@ -8,9 +8,12 @@ */ #include +#include #include #include #include +#include +#include /// @brief Quadratic equation calculator. /// @param a quadratic coefficient. @@ -71,3 +74,14 @@ std::array, 2> quadraticEquation(long double a, return solutions; } + +int main() { + std::array, 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; +}