This blog is about providing theory as well as simple executable codes of different programming languages such as java, C, C++, and web programming, etc. This blog will be helpful to the IT students to learn about programming.

Showing posts with label overloaded function calc_area(). Show all posts
Showing posts with label overloaded function calc_area(). Show all posts

Friday, February 17, 2023

write a program with an overloaded function calc_area() that calculates and returns area of circle and rectangle. Assume appropriate number and type of arguments and return type.

February 17, 2023 0
 Here's a program with an overloaded function calc_area() that calculates and returns the area of a circle and rectangle. The program assumes a radius and length/width are given as arguments for the circle and rectangle, respectively. The return type for both function is a "double".#include <iostream>using namespace std;const double PI= 3.14;double calc_area(double radius) {    return PI*radius*radius;}double calc_area(double length, double...

Slider Widget