Calculate Employee Compencation
Calculate Employee Compensation
Just open your c++ compiler Paste this code.
#include<iostream>
using namespace std;
struct info
{
int rno;
float compensation;
};
class employee
{
public:
void display(int a,float b)
{
cout<<"employee number = ";
cout<<a<<"\n";
cout<<"employee compensation in $ = ";
cout<<"$"<<b<<"\n";
}
};
int main()
{
info info1;
info info2;
employee employee1;
employee employee2;
cout<<"enter the employee number ";
cin>>info1.rno;
cout<<"enter the compensation ";
cin>>info1.compensation;
cout<<"enter the employee number ";
cin>>info2.rno;
cout<<"enter the compensation ";
cin>>info2.compensation;
employee1.display(info1.rno,info1.compensation);
employee2.display(info2.rno,info2.compensation);
}
Just open your c++ compiler Paste this code.
#include<iostream>
using namespace std;
struct info
{
int rno;
float compensation;
};
class employee
{
public:
void display(int a,float b)
{
cout<<"employee number = ";
cout<<a<<"\n";
cout<<"employee compensation in $ = ";
cout<<"$"<<b<<"\n";
}
};
int main()
{
info info1;
info info2;
employee employee1;
employee employee2;
cout<<"enter the employee number ";
cin>>info1.rno;
cout<<"enter the compensation ";
cin>>info1.compensation;
cout<<"enter the employee number ";
cin>>info2.rno;
cout<<"enter the compensation ";
cin>>info2.compensation;
employee1.display(info1.rno,info1.compensation);
employee2.display(info2.rno,info2.compensation);
}








0 comments: