C++ Program to find Area using Function Overloading

By | 01.01.2017

Area using Function Overloading

Write a C++ program to find Area of square,rectangle,circle and triangle using Function Overloading. Here’s a Simple C++ program to find Area using Function Overloading in C++ Programming Language.

What is Overloading in C++ ?

C++ allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.

Function overloading : :

You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You can not overload function declarations that differ only by return type.

Operators overloading : :

You can redefine or overload most of the built-in operators available in C++. Thus a programmer can use operators with user-defined types as well.

Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. Like any other function, an overloaded operator has a return type and a parameter list.

Below is the source code for C++ program to find Area using Function Overloading which is successfully compiled and run on Windows System to produce desired output as shown below :


/* C++ program to find Area using Function Overloading  */

using namespace std;
int area(int);
int area(int,int);
float area(float);
float area(float,float);
int main()
        int s,l,b;
        float r,bs,ht;
        cout<<"Enter side of a square:";
        cout<<"Enter length and breadth of rectangle:";
        cout<<"Enter radius of circle:";
        cout<<"Enter base and height of triangle:";
        cout<<"Area of square is"<<area(s);
        cout<<"\nArea of rectangle is "<<area(l,b);
    cout<<"\nArea of circle is "<<area(r);
    cout<<"\nArea of triangle is "<<area(bs,ht);
int area(int s)
int area(int l,int b)
float area(float r)
float area(float bs,float ht)


/*  C++ program to find Area using Function Overloading  */

Enter side of a square:2
Enter length and breadth of rectangle:3 6
Enter radius of circle:3
Enter base and height of triangle:4 4

Area of square is4
Area of rectangle is 18
Area of circle is 28.26
Area of triangle is 8

Above is the source code and output for C++ program to find Area using Function Overloading which is successfully compiled and run on Windows System to produce desired output.

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach upto you in the short interval.

Thanks for reading the post….

4.2 33 votes
Article Rating
Category: C++ Programming Overloading Programs Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Notify of

Newest Most Voted
Inline Feedbacks
View all comments

Thanks for the code, it really helped me. Keep up the good work!


This program appears incomplete


Means It looks partial


HIII I want a explanation of code



saurabh dukare

sir\mam how to find square using function overloading ?

Mishkat Dar

Thanks a lot for this great work

Nandhu 27


S. Rani

Thank you so much