DEFAULT1

Document Sample
DEFAULT1 Powered By Docstoc
					/* Write a program to implement default argument as a function to find
out the area of the circle */
#include<iostream.h>
#include<conio.h>
class shape
 {
    int a;
    float p;
    public:
      void getdata(int, float pi=3.14);
      void show()
       {
       float ans;
       ans = a * (p * p);
       cout<<"Area of the circle : "<<ans;
       }
 };
 void shape::getdata(int n,float pi)
   {
     p = pi;
     a = n;
   }


void main()
 {
    int a;
    shape circle;
    clrscr();
    cout<<"Enter the value of Radius : ";
    cin>>a;
    circle.getdata(a);
    circle.show();
    getch();
 }

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:53
posted:3/21/2010
language:
pages:1