|
-
August 13th, 2005, 07:58 AM
#18
Re: can anyone help me
#include<iostream>
#include<string>
using namespace std;
class employee
{
string first;
string last;
int salary;
public:
void getdata(void);
void setdata(void);
employee()
{
salary = 0;
last = " ";
first = " ";
}
};
void employee::getdata(void)
{
cout<<"\n a first name:"<<first;
cout<<"\n a last name:"<<last;
cout<<"\n monthly salary:"<<salary;
}
void employee::setdata(void)
{
cout<<"first name?:";
cin>>first;
cout<<"last name?:";
cin>>last;
cout<<"monthly salary?:";
cin>>salary;
}
int main()
{
employee E;
E.setdata();
cout<<"\n yearly salary:\n";
E.getdata();
return 0;
}
using this program how to do this......create two employee objects and display each object's yearly salary.the give each employee a 10 percent raise and display each employee's yearly salary again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|