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
What is rapid prototyping?​
yan [13]

Answer:

Rapid prototyping is the fast fabrication of a physical part, model or assembly using 3D computer aided design.

6 0
3 years ago
In a category of games known as _________, millions of players connect to various servers to team up with other players in very
aivan3 [116]

In a category of games known as MMORPGs, millions of players connect to various servers to team up with other players in very large virtual worlds.

<h3>What do MMORPGs mean?</h3>

The term  MMORPG connote  massively multiplayer online role-playing games.

This is known to be a type of video game that tends to make use of different elements of role-playing games (RPGs) along with those of the gameplay of multiplayer online gaming worlds.

Therefore, In a category of games known as MMORPGs, millions of players connect to various servers to team up with other players in very large virtual worlds.

Learn more about virtual worlds from

brainly.com/question/13873769

#SPJ1

3 0
2 years ago
Please help! ;(
Art [367]
Okay u have to use my teqnieq and search it up because i said so and it wil get u the right answer
8 0
3 years ago
Read 2 more answers
What is a mortgage?
wel
D is the answer. Have a good day!
8 0
3 years ago
Read 2 more answers
To create a DateTime object that represents a due date that's 90 days after the current date, you use the following code:
Helen [10]

If $due_date contains a DateTime object, $due_date_diff will contain  

c. a DateInterval object

Explanation:

  • The DateInterval class ¶  represents a date interval.
  • A date interval stores either a fixed amount of time (in years, months, days, hours etc) or a relative time string in the format that DateTime's constructor supports.
  • The diff method is just as easy to use, but provides an extra piece of information: total days. This is important because when using the DateTime object to find a difference, we have a source and destination date, and therefore we can reduce the units of time into larger denominations. However, having the total number of days in between is a valuable piece of information.
  • The PHP DateTime class has three methods that work with a DateInterval object:
  1. add
  2. sub
  3. diff

Properties

  • y  :Number of years.
  • m  :Number of months.
  • d  :Number of days.
  • h  :Number of hours.
  • i  :Number of minutes.
  • s  :Number of seconds.
4 0
3 years ago
Other questions:
  • When naming a file you should use the _____________ instead of a space in a filename.
    6·1 answer
  • Dragging or sizing affects only a ____.
    5·1 answer
  • Select all the correct answers. Which two statements are true about an OS? translates the user's instructions into binary to get
    10·1 answer
  • Is anyone really good at immerse 2 learn??
    9·1 answer
  • Given a Student class, create a class with following characteristics:
    6·1 answer
  • What is the name of the process that weighs the alternatives, gathers all necessary information, and can ultimately lead you to
    9·2 answers
  • NoSQL is a programming language used to create mobile apps.<br> a) True<br> b) False
    13·2 answers
  • What is the most vulnerable information that should be protected to prevent unauthorized access to your online files and records
    8·1 answer
  • The director of security at an organization has begun reviewing vulnerability scanner results and notices a wide range of vulner
    11·1 answer
  • Es el conjunto de manifestaciones materiales, intelectuales y espirituales que distinguen a un pueblo a)Civilización b)Cultura c
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!