Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define Length 3
- struct EmployeeStruct {
- char title [20];
- int year;
- } employee [Length];
- void printemployee (EmployeeStruct employee);
- int main () {
- for (int n=0; n < Length; n++) {
- cout << "Enter title: ";
- cin >> employee[n].title;
- cout << "Enter year: ";
- cin >> employee[n].year;
- }
- cout << "\nYou have entered these employees:\n";
- for (int n=0; n<Length; n++)
- printemployee (employee[n]);
- return 0;
- }
- void printemployee (EmployeeStruct employee)
- {
- cout << employee.title;
- cout << " (" << employee.year << ")\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment