
- 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
Find the other-end coordinates of diameter in a circler in C++
Suppose we have the center coordinate and one coordinate point on the perimeter of the circle. We have to find the another point on the perimeter. Consider the center points are (p, q), and one given point is (a, b). We have to find the point (x, y). As we know that the center is the middle point of the diameter. So we can write them like −
(p,q)=(a+x/2,b+y/2)
Or from this the (x, y) can be expressed as −
x=2p-a,y=2q-b
Example
#include<iostream> using namespace std; int getCylinderPerimeter(int d, int h) { return (2*d) + (2*h); } int main() { int diameter = 5, height = 10; cout << "Perimeter: " << getCylinderPerimeter(diameter, height) << " units"; }
Output
Perimeter: 30 units
- Related Articles
- If the coordinates of the one end of a diameter of a circle are $( 2,\ 3)$ and the coordinates if its center are $(-2,\ 5)$, then the coordinates of the other end of the diameter are:$( A)( -6,\ 7)$ $( B)( 6,\ -7)$ $( C)( 6,\ 7)$ $( D)( -6,\ -7)$
- The length of a line segment is of 10 units and the coordinates of one end-point are $(2, -3)$. If the abscissa of the other end is 10, find the ordinate of the other end.
- The centre of a circle is $( -6,\ 4)$. If one end of the diameter of the circle is at $( -12,\ 8)$, then find the point of the other end.
- Find the other end point of a line with given one end and mid using C++
- C++ program to find out number of changes required to get from one end to other end in a grid
- The line segment joining $A( 6,\ 3)$ and $B( -1,\ -4)$ is doubled in length by adding half of $AB$ to each end. Find the coordinates of the new end points.
- What is the mode of transfer of heat from one end of a metallic spoon to the other end ?
- Two opposite vertices of a square are $(-1, 2)$ and $(3, 2)$. Find the coordinates of other two vertices.
- Find All Possible Coordinates of a Parallelogram in Java?
- The two opposite vertices of a square are $(-1, 2)$ and $(3, 2)$. Find the coordinates of the other two vertices.
- Find the coordinates of a point A, where AB is a diameter of the circle whose centre is $(2, -3)$ and B is $(1, 4)$.
- Find the coordinates of a point $A$, where $AB$ is the diameter of a circle whose centre is $(2, -3)$ and $B$ is $(1, 4)$.
- How to create circler edit text in android?
- JavaScript code to find the coordinates of every link in a page
- Find the coordinates of a point A where AB is diameter of a circle whose center is $( 2,\ -3)$ and B is the point $( 1,\ 4)$.

Advertisements