
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
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 = ax2 + bx + c
For this equation, the following are defined as :
Vertex -(-b/2a, 4ac - b2/4a) Focus - (-b/2a, 4ac - b2+1/4a) Directrix - y = c - (b2 +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 Articles
- Java Program to find the vertex, focus and directrix of a parabola
- 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?
- Finding the vertex, focus and directrix of a parabola in C++
- Python Program for Finding the vertex, focus and directrix of a parabola
- Finding the vertex, focus and directrix of a parabola in Python Program
- C++ Program to Find the Vertex Connectivity of a Graph
- C++ Program to Implement a Heuristic to Find the Vertex Cover of a Graph
- C++ program to find minimum vertex cover size of a graph using binary search
- Golang program to calculate the absolute and scale of a vertex.
- 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
- Pendent Vertex, Isolated Vertex and Adjacency of a graph
- A concave mirror produces magnification of +4. The object is placed:(a) at the focus (b) between focus and centre of curvature(c) between focus and pole (d) beyond the centre of curvature
- The points $(3, -4)$ and $(-6, 2)$ are the extremities of a diagonal of a parallelogram. If the third vertex is $(-1, -3)$. Find the coordinates of the fourth vertex.

Advertisements