Search This Blog

Sunday, 23 August 2020

function overloading ex 3

 #include<iostream>

#include<conio.h>

using namespace std;

int cal(int);

int cal(int ,int);

int cal(int ,int ,int);

float cal(float,int ,int);

int main()

{

int s,l,b,h,bS,ht;

float pi=3.143;

cout<<endl;

cout<<"TO FIND AREA OF SQUARE ................";

cout<<"\nEnter the length of the square:";

cin>>s;

cout<<"\nArea of the square is:"<<cal(s);

cout<<endl;

cout<<"\n\nTO FIND THE AREA OF RECTANGLE..........";

cout<<"\nlength of rectangle is:";

cin>>l;

cout<<"\nheight of rectangle is:";

cin>>h;

cout<<"\nbreadth of rectangle is:";

cin>>b;

cout<<"\nArea of the rectangle is:"<<cal(l,b,h);

cout<<endl;

cout<<"\n\nAREA OF TRIANGLE ..........................";

cout<<"\nbase of triangle is:";

cin>>bS;

cout<<"\nheight of triangle  is:";

cin>>ht;

cout<<"\nArea of triangle is:"<<cal(pi,bS,ht);

getch();

return 0;

}

int cal(int x)

{

return ( x*x);

}

int cal(int x,int y,int z)

{

return (x*y*z);

}

float cal(float x,int y,int z)

{

return(x*y*z);

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts