Question

do a unit test for area circle c++

do a unit test for area circle c++

Homework Answers

Answer #1

I hope that you are asking an programme to find out the area of circle in C++ so here is the solution for it.

#include <iostream>
#define PI 3.14159
using namespace std;

int main()
{
//Define radius and area
float radius, area;
//Get the user input for the radius   
cout<<" Input the radius";
cin>>radius;
//Computer the area
area = PI*(radius*radius);
cout<<" The area of the circle is : "<< area << endl;
cout << endl;
return 0;
}

Kindly vote up if found useful

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
# given a radius, find the area of a circle def get_area_circle(r):        """        ...
# given a radius, find the area of a circle def get_area_circle(r):        """         what it takes             radius of a circle (any positive real number)         what it does:             computes the area of a circle             given a radius, find the area of a circle             area = pi*r2 (pi times r squared)         what it returns             area of a circle. Any positive real number (float)     """         # your code goes in...
Complete the program to calculate and print the circumference and area of a circle, rounded to...
Complete the program to calculate and print the circumference and area of a circle, rounded to the nearest tenth (1 decimal place). The starter code already prompts the user and takes in the radius as a double-value input. You need to do the calculations and print the results. I recommend using the printf() command (described in chapter 3 of the book) to print the results with the correct rounding. import java.util.Scanner; class Circle { static Scanner sc = new Scanner(System.in);...
Create a flowgorithm program to calculate the Area of Circle first then do the Circumference of...
Create a flowgorithm program to calculate the Area of Circle first then do the Circumference of Circle. The user will have the ability to convert Area OR the Circumference. That means we need to add a decision structure to the program. Furthermore, they need to be able to do it as many times as they want. That means we need to add a main loop structure to the program. The user will also have the choice of whether to run...
Find the exact area of the region inside the circle r=2cos(theta) but outside the circle r=1
Find the exact area of the region inside the circle r=2cos(theta) but outside the circle r=1
Consider the unit circe C (the circle with center the origin in the plane and radius...
Consider the unit circe C (the circle with center the origin in the plane and radius 1). Let S = {α : 2α < (the circumference of C)} . Show that S is bounded above. Let p be the least upper bound of S. Say explicitly what the number p is. This exercise works in the real number system, but not in the rational number system. Why?
Find the area of the largest trapezoid that can be inscribed in a circle of radius...
Find the area of the largest trapezoid that can be inscribed in a circle of radius 2 and whose base in as diameter of the circle.
Two vertices of an equilateral triangle lie on a diameter of a circle whose area is...
Two vertices of an equilateral triangle lie on a diameter of a circle whose area is 36p cm2, and the third vertex lies on the circle. What is the largest possible area of the triangle?
The circumference of a unit circle is 2π. The absolute value of -3π/2 is: ? of...
The circumference of a unit circle is 2π. The absolute value of -3π/2 is: ? of the total circumference of the unit circle .
If a circle C with radius 1 rolls along the outside of the circle x2 +...
If a circle C with radius 1 rolls along the outside of the circle x2 + y2 = 49, a fixed point P on C traces out a curve called an epicycloid, with parametric equations x = 8 cos(t) − cos(8t), y = 8 sin(t) − sin(8t). Use one of the formulas below to find the area it encloses. A = C x dy = −C  y dx = 1/2 C x dy − y dx
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT