/*--------------------------------------------------------------------*/ /* This program computes the area of a sector of degrees d. */ #include using namespace std; const double PI = 3.141593; int main() { /* Declare variables. */ double d, area, r, theta; /* Enter the radius of the sector. */ cout << "Enter the radius of the sector: "; cin >> r; /* Enter the angle of the sector. */ cout << "Enter the angle in degrees of the sector: "; cin >> d; /* convert the degrees to radians */ theta = d * PI / 180.0; /* Compute the area of the sector. */ area = r*r*theta/2.0; /* Print the value of the area. */ cout << "The area of a sector with radius " << r << " and angle " << d << " is " << area << endl; /* Exit program. */ return 0; } /*--------------------------------------------------------------------*/