- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C++ program to find the vertex, focus and directrix of a parabola

In this article, we will be discussing a program to find the vertex, focus and directrix of a parabola when the coefficients of its equation is given.

Parabola is a curve whose all points on the curve are equidistant from a single point called focus.

As we know the general equation for a parabola is

y = ax^{2}+ bx + c

For this equation, the following are defined as :

Vertex -(-b/2a, 4ac - b^{2}/4a) Focus - (-b/2a, 4ac - b^{2}+1/4a) Directrix - y = c - (b^{2}+1)4a

## Example

#include <iostream> using namespace std; void calc_para(float a, float b, float c) { cout << "Vertex- (" << (-b / (2 * a)) << ", " << (((4 * a* c) - (b * b)) / (4 * a)) << ")" << endl; cout << "Focus- (" << (-b / (2 * a)) << ", " << (((4 * a* c) - (b * b) + 1) / (4 * a)) << ")" << endl; cout << "Directrix- y=" << c - ((b * b) + 1) * 4 * a <<endl; } int main() { float a = 23, b = 34, c = 5; calc_para(a, b, c); return 0; }

## Output

Vertex- (-0.73913, -7.56522) Focus- (-0.73913, -7.55435) Directrix- y=-106439

- Related Questions & Answers
- Java Program to find the vertex, focus and directrix of a parabola
- Python Program for Finding the vertex, focus and directrix of a parabola
- Finding the vertex, focus and directrix of a parabola in Python Program
- Finding the vertex, focus and directrix of a parabola in C++
- C/C++ Program for Finding the vertex, focus and directrix of a parabola?
- C/C++ Program for Finding the vertex, focus and directrix of the parabola?
- C++ Program to Find the Vertex Connectivity of a Graph
- Golang program to calculate the absolute and scale of a vertex.
- C++ Program to Implement a Heuristic to Find the Vertex Cover of a Graph
- Pendent Vertex, Isolated Vertex and Adjacency of a graph
- Program to find out the minimum cost path between the lowest value vertex to the highest value vertex (Python)
- Program to calculate vertex-to-vertex reachablity matrix in Python
- C++ program to find minimum vertex cover size of a graph using binary search
- Degree of Vertex of a Graph
- Cut Set and Cut Vertex of Graph

Advertisements