BCE-2A OOP LAB
AIR UNIVERSITY
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
EXPERIMENT: 02
Lab Title: Structures in C++
Student Name: Reg. No:
Objectives: To familiarize student with Structures and it’s Purpose in C++.
LAB ASSESSMENT:
Excellent Good Average Satisfactory Unsatisfactory
Attributes
(5) (4) (3) (2) (1)
Ability to Conduct
Experiment
Ability to assimilate
the results
Effective use of lab
equipment and follows
the lab safety rules
Total Marks: Obtained Marks:
LAB REPORT ASSESSMENT:
Excellent Good Average Satisfactory Unsatisfactory
Attributes
(5) (4) (3) (2) (1)
Data presentation
Experimental results
Conclusion
Total Marks: Obtained Marks:
Date: Signature:
Submitted To: Engr. Sidrish Ehsan
Date: 04-3-2025
Page | 1
BCE-2A OOP LAB
LABORATORY
EXPERIMENT NO.2
Lab Task 01:
Write a C++ program to store employee information in structures. Structure should store
(Employee Name, Employee ID, Employment years). Ask user to enter employee data and
display it on the screen.
Lab Task 02:
Write a C++ program to store employee information in array of structures. Structure should
store (Employee Name, Employee ID, Employment years). Ask user to enter information of 5
employees & display it on the screen.
Page | 2
BCE-2A OOP LAB
Page | 3
BCE-2A OOP LAB
Lab Task 03:
Write a C++ program to store employee’s information in structures. Structure should store
(Employee Name, Employee ID, Employment years). Ask user to enter information of 5
employees & display Data through a function name display by passing structure to function.
Page | 4
BCE-2A OOP LAB
Lab Task 04:
Create a structure that will store the following information for each employee:
● Employee ID (integer)
● First name (string)
● Last name (string)
● Date of birth (string, in the format “DD-MM-YYYY”)
● Department (string)
● Display the information of a specific employee through display function
Requirement:
1. Define the structure for the employee.
2. Passing structure (pass by reference) to function.
3. Implement the required functions.
Page | 5
BCE-2A OOP LAB
CONCLUSION
• Structures offer a convenient way to group related data fields together, simplifying data
management and improving readability and maintainability of the code.
• Using an array of structures provides a systematic way to store and manage multiple
employee records, making it easier to handle and process bulk data efficiently.
• Passing the entire structure to functions allows for cleaner and more modular code, enabling
better organization and reusability of logic across the program.
• Passing the structure by reference to the display function improves efficiency by avoiding data
duplication and reducing memory overhead, making the program more optimized for handling
larger datasets.
Page | 6