Thursday, 26 May 2016

Q: Write a program that that declares a structure to store income, tax rate and tax of a person. the program defines an array of structure to store the record of five persons. it inputs income and tax rate of five persons and then displays the tax payable.



Program

#include<iostream.h>
#include<conio.h>
struct TaxPayable
{
   double income, tax_rate, taxes;
};
void main()
{
TaxPayer p[5];
int i;
cout<<"Enter annual income and tax rate of 5 persons: \n";
for(i=0;i<5;i++)
{
      cout<<"Enter annual income of tax payer #" <<i+1<<" : ";
      cin>>p[i].income;
      cout<<"Enter tax rate of tax payer #"<<i+1<<" : ";
      cin>>p[i].tax_rate;
      p[i].taxes=p[i].income*p[i].tax_rate/100;
}
cout<<" Taxes due for this year: \n";
for(i=0;i<5;i++)
cout<<" Tax Payer # "<<i+1<<" : "<<" Rs. "<<p[i].taxes<<endl;
getche();
}

1 comment: