Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int main()
- {
- char name[20],post[20],y[20];
- int salary,months;
- ofstream out("employee.txt");
- cout<<"\nEnter employee name:";
- cin.getline(name,20);
- out<<name<<"\n";
- cout<<"\nEnter the post(Manager/Worker/Hr):";
- cin.getline(post,20);
- out<<post<<"\n";
- cout<<"\nEnter the months worked:";
- cin>>months;
- out<<months<<"\n";
- cout<<"\nEnter monthly salary:";
- cin>>salary;
- out<<salary<<"\n";
- out.close();
- cout<<"\n\n";
- cout<<"...employee details...\n";
- ifstream in("employee.txt");
- in>>name;
- cout<<"Employee name:"<<name;
- in>>post;
- cout<<"\nPost of employee:"<<post;
- in>>months;
- cout<<"\nNumber of months worked:"<<months;
- in>>salary;
- cout<<"\nTotal salary:"<<salary*months;
- in.close();
- }
Add Comment
Please, Sign In to add comment