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
How many bits are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode each pixel with 12 bits o
AURORKA [14]

Just multiply all numbers to get the total number of bits:

25*50*12 = 15000 bits.

3 0
3 years ago
What would be the output of the following program?
Natalka [10]

Answer:

Output: 2004 2008 2058  

Explanation:

In the first printf command it will print the address of the variables num, msg1, msg2. And in the second printf command it will print the values of the variables num, msg1, msg2. As the address of the structure is 2004 And the size of the integer is 4 byte so size will increase with 4 bytes and the size of character is 1 byte so it will increase by 1*50= 50 bytes.

Hence, the output is 2004 2008 2058  

8 0
3 years ago
Who is your favorite MHA Character? Or what anime show of your favorite character
adoni [48]

Answer:

Many of them are interesting, and relatable too.

5 0
3 years ago
After attempting the warm-up exercises suggested by the author, describe how they made you feel. Do you feel more relaxed or
Elena-2011 [213]

First of all is there supposed to be a picture added to the question? Like with the warmups. If not then ig ill try to answer yor question without them.

If your doing vocal warmups like i do in choir it opens up your pipes so when your singing you can hit all your nots cause you vocal chord are warmed up. Thats the same for talking

7 0
3 years ago
Read 2 more answers
A client wishes to update their legacy system even though there have been no
gulaghasi [49]

Answer:

A client wishes to update their legacy system even though there have been no security breaches since its implementation five years ago. If the client has not suffered any attacks, why is it still necessary to update their system? ... Because new security threats emerge all the time.

8 0
3 years ago
Other questions:
  • Interpretations of​ Moore's law assert​ that:
    13·1 answer
  • Variable costs are __________.<br><br> A. decreasing<br> B. increasing<br> C. static
    10·1 answer
  • Suppose you want to view a document that has several headings. what view would you use?
    6·1 answer
  • Casey, a woodworker, is developing his own website. He plans to use the site as a means of selling his handmade furniture. While
    10·1 answer
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • Robert works in a call center and receives a call from Kathy. Kathy says she can no longer access the online reporting applicati
    13·1 answer
  • Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter.
    14·1 answer
  • Code: ckg-jbqp-hki<br>only girls join❤️​
    11·2 answers
  • How do you check to see if the user entered more than one character? Complete the code.
    14·1 answer
  • Choose the true statement below. (html)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!