Write a program in C++ to find the area of square and rectangle using funciton overloading
#include<iostream.h>
int area(int); int area(int,int); void main() { int l,h,a,b; cout << "enter the values of length and width"<<endl; cin >> l>>h; a=area(l); b=area(l,h); cout << "area of square is : "<<a<<endl; cout << "area of rectangle is : "<<b; } int area(int a) { return (a*a); } int area(int a,int b) { return (a*b); } |