Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- #define PI 3.1415926
- #define pTwo(x) x*x
- struct Circle{
- double radius;
- };
- struct Ring{
- Circle c1, c2;
- }ring;
- double area(Ring ring){
- return PI*pTwo(ring.c2.radius) - PI*pTwo(ring.c1.radius);
- }
- int main(){
- double startX, startY, smallRadius, largeRadius;
- while(cin >> startX >> startY >> largeRadius >> smallRadius){
- ring.c1.radius = smallRadius;
- ring.c2.radius = largeRadius;
- cout << fixed << setprecision(6) << "Area: " << area(ring) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement