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
Fill in the blank to complete the sentence. -------------------- is used to store and process data over the Internet using compu
Trava [24]

Answer:cloud computing

Explanation:

6 0
2 years ago
What is the importance of computer application to statistics​
Katarina [22]

Answer:

First off, I'm not writing your essay. I will give you a guide and you can take it from there. Also, I don't know any context about the question.

  • Computer applications can handle input and output at a significant rate.
  • Computers were designed to handle mathematical operations and now at today's rate a single 2+2 can spit out a answer in 64 nanoseconds.

4 0
3 years ago
Typically , how do people earn income
natima [27]
People earn income by getting jobs and working. When they work, they get paid. That's an income
3 0
3 years ago
Read 2 more answers
Apple users tend to like the company and love its products. Apple has successfully nurtured this __________ component of its cus
kow [346]

Answer:

Affective

Explanation:

Affective Component − This is the second model of customers attitude. This consists of a person’s feelings, sentiments, and emotions for a particular brand or product. They treat them as the primary criteria for the purpose of evaluation. The state of mind also plays a major role, like the sadness, happiness, anger, or stress, which also affects the attitude of a consumer.

7 0
2 years ago
What are the differences between a slate PC, ultrabook, and a tablet?
Vinvika [58]

Answer: The differences between ultra-book, tablet and slate PC  are mentioned as follows:-

  • Ultra-book is the notebook structure thin and slim device whereas tablets are type of computer shaped laptops in small size and slate PC has detachable display screen and is a replacement of tablet .
  • Ultra-books have large and handy keyboards, tablets have touchscreen and no keyboard presence whereas slate PC has the touchscreen operated through stylus or fingers.
  • Ultra-book have good storage space while tablets and slate PC's have less storage space in comparison.
4 0
3 years ago
Other questions:
  • What is the maximum number of hosts you can have on a network if the first decimal value of the ip address is between 192 and 22
    10·1 answer
  • A _____ stores definitions, such as data types for fields, default values, and validation rules for data in each field.
    13·1 answer
  • What is a sound wave
    7·2 answers
  • You are asked to design a system of FP numbers representation (with your own design choices), labeled Custom_FP_48, for which we
    8·1 answer
  • Choose the statement that describes an advantage of paying a bill through the mail with a check.
    6·2 answers
  • What would a match() property that passed the expression /^[0-9]/ check for?
    12·2 answers
  • You may have come across websites that not only ask you for a username and password, but then ask you to answer pre-selected per
    11·1 answer
  • Computer instructions are converted to binary when executed. Binary numbers use which set of digits?
    10·1 answer
  • When power is completely removed from your computer
    11·1 answer
  • Which block in this module represents the variable?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!