Tuesday, October 5, 2010

Ex No.1                                  PROGRAM USING DEFAULT ARGUMENTS
28-7-10
   

AIM:
To write a program using c++ to find the amount for tax percentage using default arguments.

ALGORTHIM:
Step 1:Start the program.

Step 2:Read the amount to calculate the tax percent.

Step 3:Read the tax percent

Step 4: Calculate tax amount for default tax percent

Step 5:Display the value

Step 6:Calculate tax amount for given tax amount

Step 7:Display the value

Step 8:Stop the program


PROGRAM:
 
#include<iostream.h>
#include<conio.h>
class tax
{
int t;
public:
int cal(int a,int b=2)
{
t=(a*b)/100;
cout<<t<<endl;
return t;
}
};
void main();
{
int  x,y;
clrscr();
tax s;
cout<<”\n Enter the amount to calculate tax amount <<”endl;
cin>>x;
cout<<”\nEnter the percentage of tax for the given amount “<<endl;
cin>>y;
cout<<”\nTax amount for default percent 2”<<s.cal(x)<<endl;
cout<<”\nTax amount for given amount of the given percent”<<s.cal(x,y);
getch();
}



RESULT:
Thus the c++ program to calculate tax amount using default argument has been executed and the output is verified successfully.