Lab Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

LAB #08

Submitted By:

MUHAMMAD MAAB NAWAZ (FA21-EEE-021)


Submitted to:

MAAM NAYAB GOGOSH


DATE:

29-10-2022
TASK#1

#include<iostream>
#include<string>
using namespace std;
class studentRecord
{
private:
string degree;
public:
studentRecord()
{cout<<"Constructor"<<endl;}
void getdata()
{
cout<<"Enter Degree: ";
cin>>degree;
}
};
class employeeRecord
{
private:
int emp_id;
double salary;
public:
employeeRecord ()
{}
void getdata()
{
cout<<"Enter Employee ID: ";
cin>>emp_id;
cout<<"Enter Salary: ";
cin>>salary;
}
};
class manager
{
private:
string title;
double dues;
employeeRecord emp;
studentRecord stu;
public:
void getdata()
{
emp.getdata();
cout<<"Enter Title: ";
cin>>title;
cout<<"Enter Dues: ";
cin>>dues;
stu.getdata();
}
};
int main()
{
manager m1;
cout<<"Enter data for manager 1: ";
m1.getdata();
system("pause");
}
TASK#2
Code

#include<iostream>
#include<string>
using namespace std;
class Address{
private:
string street;
string house;
string city;
string code;
public:
void get(){
cout<<"Emter street"<<endl;
getline(cin,street);
cout<<"Emter house"<<endl;
getline(cin,house);
cout<<"Emter city"<<endl;
getline(cin,city);
cout<<"Emter code"<<endl;
getline(cin,code);
};
void display(){
cout<<"The street is"<<street<<"house is"<<house<<"city is"<<city<<"code
is"<<code<<endl;
}
};
class person{
private:
Address address;
public:
void get(){

address.get();
address.display();

};
};
int main(){
person p1;
p1.get();
return 0;
}
TASK#3
HOME TASK:
#include<iostream>
#include<sstream>
using namespace std;
int main(){
string str = "102";
int i;
istringstream(str) >> i;
cout<<i;
return 0;
}

You might also like