1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lianna [129]
3 years ago
9

Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle’s

radius, diameter, circumference, and area. Your program must have at least the following functions: distance: This function takes as its parameters four numbers that represent two points in the plane and returns the distance between them.
Computers and Technology
1 answer:
sergij07 [2.7K]3 years ago
4 0

Here is the code in C++.

#include <bits/stdc++.h>

using namespace std;

// function to calculate distance between two points

double distance(int a,int b,int c,int d )

{

 // return the distance between center and point

  return sqrt(pow(c - a, 2) +

               pow(d - b, 2) * 1.0);

}

// driver function

int main()

{

// variables to store coordinates

int x1,y1,x2,y2;

cout<<"Please Enter the center(x y) of the circle: ";

//reading center

cin>>x1>>y1;

cout<<"\nPlease Enter a point(x1 y1) on the circle:";

//reading point

cin>>x2>>y2;

// calling distance() function with 4 parameters

double rad=distance(x1,y1,x2,y2);

// calculating Radius and print

cout<<"Radius of circle is: "<<rad<<endl;

// calculating Diameter and print

cout<<"Diameter of circle is: "<<2*rad<<endl;

// calculating Circumference and print

cout<<"Circumference of circle is: "<<2*3.14*rad<<endl;

// calculating Area and print

cout<<"Area of circle is: "<<3.14*rad*rad<<endl;

return 0;

}

Explanation:

First it will read coordinates of center and point on the circle.The distancebetween center and point on circle is Radius. Call distance() function withfour parameters which are coordinates of center and point. This will return the value of Radius. Diameter is 2 times of Radius.Diameter of a circle is 2*3.14*Radius. and Area of the circle is calculate as 3.14*Radius*Radius. After finding these value print them.

Output:

Please Enter the center(x y) of the circle: 0 0

Please Enter a point(x1 y1) on the circle: 3 4

Radius of circle is: 5

Diameter of circle is: 10

Circumference of circle is: 31.4

Area of circle is: 78.5

You might be interested in
Help pleaseeeeeeeeeeeee
viktelen [127]
By dragging its borders
7 0
2 years ago
Read 2 more answers
Why is it important to ask an interviewer at least one question at the end of an interview?
tatiyna
Because it, not only does it give you a chance to learn more about the workplace, it also makes you look more interested in the position.
<span />
4 0
2 years ago
Read 2 more answers
Trent is researching what it would take to become a pharmaceutical scientist. What academic requirements should he complete?
Llana [10]

Answer:

D - a doctorate degree

Explanation:

You are studying in a role as a doctors position.

8 0
1 year ago
You have a small company and want to keep your costs low, but it is important your employees share data. Which network would pro
Crank

Answer:

centralised

Explanation:

duhh

7 0
2 years ago
Read 2 more answers
List two types of energy sources
makvit [3.9K]

Answer:

Types of energy sources include;

  • Geothermal energy
  • Solar energy
  • Wind power
  • Nuclear energy
  • Hydropower
  • Coal burning
  • Natural gas
  • Biomass energy
8 0
2 years ago
Read 2 more answers
Other questions:
  • In 1-2 pages, identify a social networking technology and identify at least 10 security and/or privacy risks the technology has
    8·1 answer
  • How are traditional technology and modern technology related to each<br>other? ​
    9·2 answers
  • 5. Question<br> The control flag that isn't really in use by modern networks is the<br> flag.
    15·1 answer
  • What power brake uses vacuum from the engine to aid in brake application?
    6·2 answers
  • Give two advantages of representing integers in pure binary.
    5·1 answer
  • A new attack involves hacking into medical records and then offering these records for sale on the black market. A medical recor
    14·1 answer
  • Which of the following sentences use personification 
    9·1 answer
  • A ____________ is a collection of commands given a name.
    11·1 answer
  • Priortization is an example of a skill that helps you reach long term goals because
    14·1 answer
  • Help me with thissssss
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!