Question
Write a C++ program that defines separate functions to: (8 Marks)
a. Calculate the area of a circle
b. Calculate the circumference of a circle
The radius should be entered by the user from the main() function and passed to both functions.
Answer :
Word Count : 578
_______ _______ __________ _______ ____ ___ _____ ____ ______ ____ _____.
__________ ______ _______ ____ ________ ____ ___ ________.
_____ ________ ________ _______ _____.
___ ______ ________ ________ __________ _________.
____ ________ _________ ____ _____ _______ __________ _____ ____ _________ _______.
________ ________ ___ ___ __________.
____ ___ ________ _______ ___ __________ _____ __________ ______ ___ ____.
______ ____ ___ _____ ___ ______ __________ _________ ______ ___.
_______ ______ ____ _____ __________ _________ ___ ____ ________ ____ ___ _________.
________ _______ ________ _______ _________ ________.
______ ______ ________ ______ _______ ____ ___ ________ _____ ________.
_______ ___ _______ _________ ________ ___ _______ ______.
_____ _________ _________ _____ ___ ______ _________ ________ ____.
__________ ___ _____ ________ ________ ________ _____.
_______ ________ ___ __________ ___ _________.
_____ _____ ____ ________ _____ _______.
_________ ___ _________ _______ _______ ____ _________ ______ ___.
_______ _________ _____ ______ __________ _______ ___ _____ ________ ________ ________.
___ __________ ____ ________ ____ _____ _____ ________ ________ __________ _____ _________.
___ _____ ___ ____ ___ __________ _______.
________ _________ ____ ____ _________ ______ _________ ________ ________.
________ _________ ____ ___ _______ ________ _________ ___ ______ ______ ___.
__________ _______ ________ ________ _________ ______ ___ ____ __________ ________.
____ ________ _____ ___ ___ ___ ___ ______ ____ _________.
_________ __________ ________ ____ _____ __________ _____ ________ ____ ________.
_____ ________ _______ ________ ________ __________ _________ ___ _____.
____ _____ ___ ________ ___ ____ ___ ____.
___ ____ ________ ____ ______ __________ _________ ________ _________ _________ _______.
______ _____ _______ ___ ________ _______ ________ ________ __________.
_____ _________ ___ ___ ______ _____ ______ ___ _________ ___ _____.
_________ ______ _________ ________ ___ _______ ______ _________.
_______ _______ ______ ___ _____ ________ _____ ________ _____ _______.
_______ ______ _____ _____ ________ _________ _________ __________ _______.
_____ _________ _____ _______ _____ ____ ______ _____ ____ ___ __________ ______.
_________ __________ ________ ________ __________ ___ ____ __________ ____ ________ ___.
____ __________ _______ __________ ________ ____ _____ ___ ____.
_______ _______ __________ __________ _________ ________ ________ _____ ___ _______.
____ ___ ____ _____ ______.
_______ ____ __________ __________ ________ _______ ________ _________ _________.
________ _____ ______ _____ _________ ______ __________ __________ ______ _____ ________.
_________ _____ ______ _________ ________ __________ ______ __________ ______ _____ ______.
____ _______ _______ _______ ______ __________ _____.
________ _________ ________ _______ ________ ____ ___ ________ _____ ______ ________ ________.
______ _________.
Skip in 10
A C++ program can be designed by defining two separate functions: one to calculate the area of a circle and another to calculate its circumference. The radius is entered by the user inside the `main()` function and is then passed as an argument to both functions. This demonstrates the use of user-defined functions, function arguments, return values, and modular programming in C++. The formula for the area of a circle is: Area = π × r × r The formula for the circumference is: Circumference = 2 × π × r Here, `r` represents the radius and π can be taken as `3.14159`. ```cpp #include using namespace std; // Function to calculate the area of a circle double calculateArea(double radius) { return 3.14159 * radius * radius; } // Function to calculate the circumference of a circle double calculateCircumference(double radius) { return 2 * 3.14159 * radius; } int main() { double radius; // Enter radius from the user cout << "Enter the radius of the circle: "; cin >> radius; // Calling both functions and passing radius
__________ ______ ___ __________ ________._______ _______ __________ _______ ____ ___ _____ ____ ______ ____ _____.
__________ ______ _______ ____ ________ ____ ___ ________.
_____ ________ ________ _______ _____.
___ ______ ________ ________ __________ _________.
____ ________ _________ ____ _____ _______ __________ _____ ____ _________ _______.
________ ________ ___ ___ __________.
____ ___ ________ _______ ___ __________ _____ __________ ______ ___ ____.
______ ____ ___ _____ ___ ______ __________ _________ ______ ___.
_______ ______ ____ _____ __________ _________ ___ ____ ________ ____ ___ _________.
________ _______ ________ _______ _________ ________.
______ ______ ________ ______ _______ ____ ___ ________ _____ ________.
_______ ___ _______ _________ ________ ___ _______ ______.
_____ _________ _________ _____ ___ ______ _________ ________ ____.
__________ ___ _____ ________ ________ ________ _____.
_______ ________ ___ __________ ___ _________.
_____ _____ ____ ________ _____ _______.
_________ ___ _________ _______ _______ ____ _________ ______ ___.
_______ _________ _____ ______ __________ _______ ___ _____ ________ ________ ________.
___ __________ ____ ________ ____ _____ _____ ________ ________ __________ _____ _________.
___ _____ ___ ____ ___ __________ _______.
________ _________ ____ ____ _________ ______ _________ ________ ________.
________ _________ ____ ___ _______ ________ _________ ___ ______ ______ ___.
__________ _______ ________ ________ _________ ______ ___ ____ __________ ________.
____ ________ _____ ___ ___ ___ ___ ______ ____ _________.
_________ __________ ________ ____ _____ __________ _____ ________ ____ ________.
_____ ________ _______ ________ ________ __________ _________ ___ _____.
____ _____ ___ ________ ___ ____ ___ ____.
___ ____ ________ ____ ______ __________ _________ ________ _________ _________ _______.
______ _____ _______ ___ ________ _______ ________ ________ __________.
_____ _________ ___ ___ ______ _____ ______ ___ _________ ___ _____.
_________ ______ _________ ________ ___ _______ ______ _________.
_______ _______ ______ ___ _____ ________ _____ ________ _____ _______.
_______ ______ _____ _____ ________ _________ _________ __________ _______.
_____ _________ _____ _______ _____ ____ ______ _____ ____ ___ __________ ______.
_________ __________ ________ ________ __________ ___ ____ __________ ____ ________ ___.
____ __________ _______ __________ ________ ____ _____ ___ ____.
_______ _______ __________ __________ _________ ________ ________ _____ ___ _______.
____ ___ ____ _____ ______.
_______ ____ __________ __________ ________ _______ ________ _________ _________.
________ _____ ______ _____ _________ ______ __________ __________ ______ _____ ________.
_________ _____ ______ _________ ________ __________ ______ __________ ______ _____ ______.
____ _______ _______ _______ ______ __________ _____.
________ _________ ________ _______ ________ ____ ___ ________ _____ ______ ________ ________.
______ _________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.