Pure Programmer
Blue Matrix


Cluster Map

Project: Quadradic Equations

Write a program that computes the value of the [[quadratic equation]] y = ax² + bx + c. Used named constants for a, b and c and use variables for x and y. Initially set a, b and c to 3, 2 and 1 respectively then print out y for x = 0,1,2 and 3. Use the increment operator ++ to change your x variable before each successive computation of y. Then try changing the values of a, b and c to compute different quadratic equation.

Output
$ g++ -std=c++17 QuadraticEquations.cpp -o QuadraticEquations -lfmt $ ./QuadraticEquations f(0) = 1 f(1) = 6 f(2) = 17 f(3) = 34

Solution