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
Effective communication skills are a desirable workplace skill
OLga [1]
Yes. If there is no effective communication in the workplace then nothing is going to be done.
4 0
3 years ago
Even closed systems are never perfectly closed. <br>true false​
Oxana [17]

Answer:

True

Explanation:

You can learn through many different textbooks that a closed system is always closed.

3 0
3 years ago
To save a new copy of an existing database, a user can open the original database and select ________ from the file tab.
Yuri [45]
And select copy from the file tab.
6 0
3 years ago
Programs that do the same thing every time they run are called...
Misha Larkins [42]

Answer:

predictable

Explanation:

because it repeat itself all time

6 0
2 years ago
Discuss the major differences in two approaches ofprogramming i.e. Object oriented programming and structuredprogramming.
Romashka-Z-Leto [24]

Answer:

Differences between Object Oriented Programming and Structured Programming

1. Structured programming focuses on process/logic then data while OOP(Object Oriented programming) focuses on data.

2.OOP supports Inheritance,Encapsulation,Abstraction,Polymorphism while structured programming does not supports these.

3.Structured programming follows top-down approach while OOP follows bottom-up approach.

4.OOP is more secured than structured programming because it supports Abstraction (data hiding).

7 0
3 years ago
Other questions:
  • To reboot a pc, hold down the ____ keys at the same time.
    15·1 answer
  • What would happen if a pc that contains a power supply that does not automatically adjust for input voltage is set to 230 volts
    13·1 answer
  • How can i become an expert in computer and technology?
    15·2 answers
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • Please help me answer this question
    14·1 answer
  • The association between a UCS and a CS can be extended to include more stimuli (more stimuli related to the CS can elicit the CR
    7·1 answer
  • My computer just fried anybody know why it did that?
    14·2 answers
  • Does -8 = -21?<br>[this is NOT a trick question]<br>Yes....?<br>No!​
    12·2 answers
  • What read a page on website​
    15·1 answer
  • Just help :(((((((((((((((((((((((((((((((((((
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!