[go: up one dir, main page]

0% found this document useful (0 votes)
109 views7 pages

ECE 2305 - Programming Project 02

The document outlines a programming project for ECE 2305, focusing on creating a C++ application to solve quadratic equations of the form ax^2 + bx + c = 0. It details the program's features, structure, and flowchart, emphasizing user input for coefficients and the calculation of solutions based on the discriminant. Additionally, it includes requirements for documentation, including a description of the program, a flowchart, code listing, and screen captures of different solution scenarios.

Uploaded by

Nl Fishing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views7 pages

ECE 2305 - Programming Project 02

The document outlines a programming project for ECE 2305, focusing on creating a C++ application to solve quadratic equations of the form ax^2 + bx + c = 0. It details the program's features, structure, and flowchart, emphasizing user input for coefficients and the calculation of solutions based on the discriminant. Additionally, it includes requirements for documentation, including a description of the program, a flowchart, code listing, and screen captures of different solution scenarios.

Uploaded by

Nl Fishing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ECE 2305 – Introduction to C Programming

Programming Project 02
Quadratic Equation Solver

Program Features: Branch structure, variables, data input and output, mathematical
operators, function calls.

Design a C++ application that calculates and displays all solutions to quadratic algebraic
equations of the form

𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0

with real-numbered values of the constant coefficients a, b and c entered by the user. Your
application should rely on the standard quadratic formulas:

−𝑏 + √𝑏 2 − 4𝑎𝑐
𝑥1 =
2𝑎

−𝑏 − √𝑏 2 − 4𝑎𝑐
𝑥2 =
2𝑎

Structure the program as shown in the following Flow Chart. It is recommended that you
perfect the structure of the program before including the calculations.
Start

Prompt user for a, b and c.

Y a == 0 N

Y b == 0 N Y b2–4ac N
> 0

Y b2–4ac N
“No solution.”
== 0

“One real solution.”


“Two real equal solutions.”

“Two real unequal solutions.”

“Two complex conjugate solutions.”

Following a common practice among electrical engineers, use the symbol j in your display
to represent the square root of –1.

Document the program with the following sections:

A. A brief written description of the purpose of the program including the inputs, the
outputs and a description of the structure of the programming.
This program will take three inputs for A B and C. it will then plug them into a quadratic
equation to find the solutions of the problem. It will use if else statements to filter out unreal
solutions, and find what type of solutions are in the equation. It will then find the solutions
if applicable.
B. A flowchart including all of the equations for the various solutions.

Start

Prompt user for a, b and c.

Y N
a == 0

Y N Y N
b == 0 b2–4ac
> 0

Y N
“No solution.” b2–4ac
== 0

“One real solution.”


Display x = -c/b “Two real equal solutions.”
Like x intercept of Display one part of quadratic equation
y = mx + b

“Two real unequal solutions.”


Display both versions of quadratic
equation

“Two complex conjugate solutions.”


Make b^2 – 4ac positive and then display
both solutions with j at the end
C. The code listing.
D. Screen capture images showing the operation of the program for each of the possible
solutions.

No Solution:

One Real Solution:


Two Real Equal Solutions:

Two Unequal Real Solutions:


Two Complex Conjugate Solutions:

Submit the documentation in a PDF document on Blackboard.

You might also like