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
Why is weather forecast so important for hang gliders?
professor190 [17]
Well, it wouldn't be such a good idea if they got caught up in a storm, would it? :p

Strong winds could blow them off-course, or even lightning has a chance of striking the hand glider, causing damage to the glider, the person, or even both.

Additionally, a weather forecast can help in my generic situations. For example, knowing whether to wrap up warm for cold weather, or wear something a bit more loose and breathable for hot weather.
6 0
3 years ago
You should always keep a backup of data stored in the cloud because the cloud provider does not automatically do this True or fa
Art [367]

Answer:

False

Explanation:

8 0
3 years ago
You should always buy the biggest camera bag that you can find for extra equipment.
Akimi4 [234]

Answer:

true

Explanation:

7 0
3 years ago
Read 2 more answers
1.
aliya0001 [1]
#1 is D #2 is B #3 is A #4 is D #5 is B
3 0
3 years ago
Read 2 more answers
you work in the Human Resources department of a company that has partnered with a similar company in Brazil on a big contract. y
Phoenix [80]

Answer:

Option C: Organizational Chart.

Explanation:

The main goal, in this case, it's to help the team to know the company and its integrants.

An organizational chart -- also called organigram -- is the best tool to clarify how the Brazilian company works.

The organigram is a diagram that illustrates the structure of an organization, how one part its related to another, and the assigned responsibilities of each specific department. Through this tool, the team will have a clear idea of who their counterparts are and how their job is related to ours.

4 0
3 years ago
Other questions:
  • What action makes RAM on your computer disappear?
    12·2 answers
  • Suppose you wanted to run a web server or ftp server from your home. what type of ip address would you want?​
    6·1 answer
  • Excel assigns the name ____ to the first excel table created in a workbook.
    10·1 answer
  • When you use the fill handle to copy a formula to adjacent cells, this creates what kind of cell reference?
    5·1 answer
  • why does it not let me create a new account when i log out of this one and go to join now after i fill everything out it wont le
    11·1 answer
  • Select the recommended design practice that applies to a web site using images for main site navigation.
    7·1 answer
  • How many questions have you seen so far other than this one?
    10·2 answers
  • Edhesive 2.3 code practice question 1​
    11·1 answer
  • (20 points). Some matrixes have very special patterns, for example, in the following matrix, the numbers in the first row are eq
    14·1 answer
  • ¿por que hay peligros en internet?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!