0% found this document useful (0 votes)
24 views4 pages

Lab 12 Structure

Uploaded by

hayatlucky064
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

Lab 12 Structure

Uploaded by

hayatlucky064
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Bahria University, Islamabad

Department of Software Engineering


Computer Programming Lab (Fall-2024)
Teacher: Engr. Muhammad Amin Khan

Student : Hayat Nabi


Enrollment : 09-131242-097

Lab Journal: 12
Date: 15 - 12 - 2024

Documentation
Task Wise Marks Total
Task Marks Marks
No:
Assigned Obtained Assigned Obtained (20)

1 3
2 3
3 3 5
4 3
5 3

Comments:

Signature
Hayat Nabi Computer Programming Engr. M Amin Khan
09-131242-07 Lab # 12 Dept of SE, BUIC

Lab No: 12 - Structures

Task 01 :

Employee Details Management:

Write a program to manage employee details in a company using a structure. The


program should allow the user to input the employee's name, age, and salary. Then,
display these details in a formatted manner.

Solution:

Code:

#include<iostream>
using namespace std;

struct EmployeeDetail{
string Name;
int Age;
double salary;

void GetDetail(){
cout<<"Employee Name : "<<Name <<endl;
cout<<"Employee Age : "<<Age <<endl;
cout<<"Employee Salary : "<<salary <<endl;
}
};

int main(){
EmployeeDetail E1;
cout<<"Enter Employee Name : ";
getline(cin,E1.Name);
cout<<"Enter Employee Age : ";
cin>>E1.Age;
cout<<"Enter Employee Salary : ";
cin>>E1.salary;
E1.GetDetail();

2
Hayat Nabi Computer Programming Engr. M Amin Khan
09-131242-07 Lab # 12 Dept of SE, BUIC

Screenshot:

Task 02:

Student Grades Record:

Write a program to store and display the details of a student, including their name, roll
number, and marks in three subjects. Use a structure to hold this data, calculate the
total marks, and display the student's information along with the total.

Solution:

Code:

#include<iostream>
using namespace std;

struct Display_Student_Details{
string Name;
string Roll_Number;
double Marks1 , Marks2 , Marks3;

void GetStdDetails(){
double TotalMarks = Marks1 + Marks2 + Marks3;
cout<<"\n\n\tStudent Name : " <<Name <<endl;
cout<<"\tStudent Roll-Number : "<<Roll_Number <<endl;
cout<<"\tTotal Marks : "<<TotalMarks;
}
};

3
Hayat Nabi Computer Programming Engr. M Amin Khan
09-131242-07 Lab # 12 Dept of SE, BUIC

int main(){
Display_Student_Details Std1;
cout<<"Enter Student Name : ";
getline(cin,Std1.Name);
cout<<"Enter Student Roll Number : ";
cin>>Std1.Roll_Number;
cout<<"Enter First Subject Marks :";
cin>>Std1.Marks1;
cout<<"Enter Second Subject Marks :";
cin>>Std1.Marks2;
cout<<"Enter Third Subject Marks :";
cin>>Std1.Marks3;
Std1.GetStdDetails();
}

Screenshot:

You might also like