Here is a very simple employee's information system that I wrote using C++ in a very long time ago when I am still teaching in the University here in my hometown in Bacolod City. I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler in writing this simple program using struct as my data structure.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.
Program Listing
#include <iostream>
#include <iomanip>
using namespace std;
struct emp {
string name;
int age;
float salary;
};
main() {
emp users[3];
cout << "\t Employees Information System";
cout << "\n\n";
for (int x=0; x<3; x+=1) {
cin.ignore();
cout << "Enter your name :";
getline(cin,users[x].name);
cout << "Enter your age :";
cin >> users[x].age;
cout << "Enter your salary :";
cin >> users[x].salary;
}
cout << "\n\n";
cout << "\t List of Employees";
cout << "\n\n";
for (int x=0; x<3; x+=1) {
cout << setprecision(2) << fixed;
cout << "\n" << setw(5) << users[x].name
<< setw(10) << users[x].age
<< setw(15) << users[x].salary;
}
cout << "\n\n";
system("pause");
}
No comments:
Post a Comment