Showing Page:
Bahria University, Lahore Campus
Department of Computer Science
Lab Journal 02
(Spring 2021)
Object Oriented Programming - Lab
Date: _______________
Course Code:
Max Marks: 10
Faculty’s Name:
Ms. Iqra Ashraf
Name: Muhammad Ali Ehtisham Enroll No: 054 Class:BSCS2A
Upon completion of this lab session, learners will be able to:
Define classes and objects
Lab Tasks:
Task 1
Create an employee class, basing it on previous lab. The
member data should comprise an int for storing the employee
number, a string for storing the name and a float for storing the
employee’s salary. Member functions should allow the user to
enter this data and display it. Write a main () that allows the
user to enter data for three employees and display it.
using namespace std;
class employee
int empno;
string empname;
float salary;
void getdata()
cout <<"Enter employee no:";
cin >> empno ;
cout <<endl<< "Enter salary:"<<endl;
cin >> salary;
cout << endl << "Enter employee name:" << endl;
cin >> empname;
int main()
Showing Page: