U1p1.cpp

#include <iostream.h> #include <conio.h> int area(int); int area(int,int); float area(float,int); void main() { clrscr(); int r,l,b; float pi=3.14; cout<<"\n1. Enter side of square : "; cin>>l; cout<<"-> Area of square : "<<area(l)<<" sq. units\n"; cout<<"\n2. Enter length and breadth of rectangle : \n"; cin>>l>>b; cout<<"-> Area of rectangle : "<<area(l,b)<<" sq. units\n"; cout<<"\n3. Enter radius of circle : "; cin>>r; cout<<"-> Area of circle : "<<area(pi,r)<<" sq. units\n"; getch(); } int area(int side) { return side*side; } int area(int l,int b) { return l*b; } float area(float pi,int r) { return pi*r*r; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.