VB icon

Payroll System Using Structure in C++

Email
Submitted on: 10/1/2015 12:02:44 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: C++ (general)
Views: 13339
author picture
 
     I this article I would like to share with you guys a sample program that I wrote a long time ago in my C++ programming class in college using structure as our data structure. I called this program payroll system that will compute the salary of an employee in the company. To give you some idea structure is also known as records in other programming language such as Pascal it can contains several variables and different data type but still belong with the same entity. If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Payroll System Using Structure in C++
// Description:I this article I would like to share with you guys a sample program that I wrote a long time ago in my C++ programming class in college using structure as our data structure. I called this program payroll system that will compute the salary of an employee in the company. To give you some idea structure is also known as records in other programming language such as Pascal it can contains several variables and different data type but still belong with the same entity. 
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
struct employee {
string name, department;
int age;
char gender;
float days, rate;
};
main() {
float solve=0.00;
string sex;
employee user;
 cout << "\t\t XYZ Payroll Solver 1.0";
 cout << "\n\n";
 cout << "\t Created By: Mr. Jake R. Pomperada, MAED-IT";
 cout << "\n\n";
 cout << "Enter the Name of the Employee: ";
 getline(cin,user.name);
 cout << "Enter the Name of Department : ";
 getline(cin,user.department);
 cout << "Enter the Gender of the Employee : ";
 user.gender = getchar();
 cout << "Enter the Number of Days Worked: ";
 cin >> user.days;
 cout << "Enter the Daily Rate : ";
 cin >> user.rate;
 solve = (user.days * user.rate);
 if (user.gender == 'M' || user.gender == 'm')
{
 sex = "Male";
}
 else if (user.gender == 'F' || user.gender == 'f')
{
 sex = "Female";
}
cout << fixed;
cout << setprecision(2);
 cout << "\n\n";
 cout << "\t ===== GENERATED REPORT =====";
 cout << "\n\n";
 cout << "\nEmployee Name : " << user.name;
 cout << "\nDeparment : " << user.department;
 cout << "\nGender: " << sex;
 cout << "\nSalary: $" << solve;
 cout << "\n\n";
 system("pause");
}


Other 70 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.