Доорх бодлогын, Бодлогын даалгаврыг бич
#include<conio.h>
#include<string.h>
#include<iostream.h>
class Fransh;
class Company { float income, cost;
void sum(Fransh &f1,Fransh &f2,Company &c);
public:
friend void tax(int p,Fransh &f1,Fransh &f2,Company &c);
char name[20];Company();
void print(Fransh &f1,Fransh &f2,Company &c);
};
class Fransh { float income, cost;
public:
friend class Company;
friend void tax(int p,Fransh &f1,Fransh &f2,Company &c);
char name[20];Fransh();
void change(); void print();
};
Company::Company()
{ strcpy(name,"Company");
income=400.1; cost=210.1;}
Fransh::Fransh()
{ strcpy(name,"Franshiz 1");
income=200.4; cost=110.4;}
void Fransh::change()
{ strcpy(name,"Franshiz 2");
income=300.2;cost=150.2;}
void Company::print(Fransh &f1,Fransh &f2,Company &c)
{ cout<<"Company Name:\n\t"<<c.name<<"\n\tIncome:\t"<<c.income<<"\n\tCost:\t"<<c.cost<<endl;
int k;cout<<"\nAddition information key:";cin>>k;if(k==7) c.sum(f1,f2,c);}
void Fransh::print()
{cout<<"Franshiz Name:\n\t"<<name<<endl;
cout<<"\tIncome: "<<income<<endl;
cout<<"\tCost: "<<cost<<endl;}
void Company::sum(Fransh &f1,Fransh &f2,Company &c)
{ float k=c.income+f1.income+f2.income;
float k1=c.cost+f1.cost+f2.cost;
cout<<"\nCompany and Fransh total income:\t "<<k<<"\n";
cout<<"Company and Fransh total cost: \t "<<k1<<"\n";
cout<<"\t\t Name:"<<"\t\tIncome:"<<"\t\tCost: "<<endl;
cout<<"\t\t"<<f1.name<<"\t"<<f1.income<<"\t"<<f1.cost<<"\n";
cout<<"\t\t"<<f2.name<<"\t"<<f2.income<<"\t"<<f2.cost<<"\n";}
void tax(int p,Fransh &f1,Fransh &f2,Company &c)
{ float j=c.income-c.cost; j*=p; j/=100;
cout<<"\tCompany tax :\t "<<j<<"\n";
float j1=f1.income-f1.cost; j1*=p; j1/=100;
float j2=f2.income-f2.cost; j2*=p; j2/=100;
cout<<"\tFransh tax:\t "<<j1<<"\n";cout<<"\t\t\t "<<j2<<"\n";
cout<<"\t Company and Fransh total tax:\t "<<j+j1+j2<<"\n";}
void main()
{ clrscr();
int p;
Company c; Fransh f1,f2;
f2.change();
f1.print(); f2.print();
c.print(f1,f2,c);
cout<<"\tProcent of tax:";cin>>p;
tax(p,f1,f2,c);
getch();
}
No comments:
Post a Comment