//Program to compute area of circle, triangle, rectangle using function // over-loading. #include#include #include #include void area(float rad) { float ar = 3.14 * rad * rad ; cout << "\n" << ar << " sq units is the area of the Circle " << endl; } void area(float base , float height) { float ar = 0.5 * base * height ; cout << "\n" << ar << " sq units is the area of the Triangle " << endl; } void area(float length , int breadth) { float ar = length * breadth ; cout << "\n" << ar << " sq units is the area of the Rectangle " << endl; } void main() { clrscr(); float r,bs,h,l; int b,ch; y: cout << "\nTo calculate the Area of figures" << endl; cout << "********************************" << endl; cout << "\n"; cout << "1) Area of Circle " << endl; cout << "2) Area of Triangle " << endl; cout << "3) Area of Rectangle " << endl; cout << "4) Exit " << endl; cout << "********************************" << endl; cout << "Enter your choice : " ; cin >> ch; cout << "\n"; switch(ch) { case 1: cout << "Enter the Radius of the Circle : " ; cin >> r; area(r); system("PAUSE"); goto y; case 2: cout << "Enter the Base of the Triangle : " ; cin >> bs; cout << "\nEnter the height of the Triangle : " ; cin >> h; area(bs,h); system("PAUSE"); goto y; case 3: cout << "Enter the Length of the Rectangle : " ; cin >> l; cout << "\nEnter the Breadth of the Rectangle : " ; cin >> b; area(l,b); system("PAUSE"); goto y; case 4: cout << "Exiting ... \n"; } getch(); }