PPR
PPR
#include <iostream>
using namespace std;
struct Employee {
int Emp_No;
char Emp_Name[15];
float Emp_Basic;
};
int sizeOfEmp;
void display(Employee E[], int index)
{
if (index <= sizeOfEmp) {
for (int i = 0; i < index; i++) {
cout << endl << "Employee_No :" << E[i].Emp_No;
cout << endl << "Employee_Name :" << E[i].Emp_Name;
cout << endl << "Employee_Basic :" << E[i].Emp_Basic;
}
}
else
{
cout << "Error! Out Of Range Parameter" << endl;
}
}
void sort(Employee E[], int index)
{
if (index <= sizeOfEmp) {
Employee temp;
for (int i = 0; i < index; i++)
{
for (int j = i + 1; j < index+1; j++)
{
if (E[i].Emp_Basic > E[j].Emp_Basic) {
temp = E[j];
E[j] = E[i];
E[i] = temp;
}
}
}
}
cout<<"Sorting Complete: "<<endl;
}
void NetSalary(Employee E[], int index)
{
cout<<endl << "=======================" << endl<<"Net salaries of employee
are"<<endl;
float Salary[50];
if (index <= sizeOfEmp)
{
for (int i = 0; i < sizeOfEmp; i++)
{
Salary[i] = (1.25) * E[i].Emp_Basic;
cout << "Employee No :" << E[i].Emp_No << "Net Salary :" << Salary[i] <<
endl;
}
}
}
void main() {
int input;
cout << "Enter Size of Employee Array :";
cin >> input;
while (input <= 0)
{
cout << "Enter valid Size of Employee Array :";
cin >> input;
}
sizeOfEmp = input;
Employee *E= new Employee[input];
for (int i = 0; i < input; i++) {
cout << "Enter Emp Number :";
cin >> E[i].Emp_No;
cout << "Enter Emp Name :";
cin >> E[i].Emp_Name;
cout << "Enter Emp Basic :";
cin >> E[i].Emp_Basic;
}
display(E, 2);
sort(E, 2);
NetSalary(E, 2);
}
Output
Enter Size of Employee Array :1
Enter Emp Number :25
Enter Emp Name :burhan
Enter Emp Basic :20000
Error! Out Of Range Parameter
Sorting Complete:
=======================
Net salaries of employee are
Question 2:
#include <iostream>
int main()
{
cout << "M .Burhan" << endl;
cout<<"the suggestion to handle the situation is "<<endl;
cout<<"The Prime Minister’s Citizen Assistance and Relief in Emergency Situations Fund (PM
CARES Fund) were created on 28 March 2020 following the COVID-19 pandemic in Pakistan"<<endl;.
cout<<"The fund will be used for combat, containment and relief efforts against the coronavirus outbreak
and similar pandemic like situations in the future."<<endl;
cout<<"The PM is the chairman of the trust. Members will include the defence, home and finance
ministers."<<endl;
cout<<"The fund will also enable micro-donations. The minimum donation accepted for the PM CARES
Fund is ₹10billon "<<endl;
cout<<"The donations will be tax-exempt and fall under corporate social responsibility"<<endl;
return 0;
}
Question 3
void SSD2HDD (copy())
{ DATA_SDD,DATA_HDD
copy(DATA_SSD TO DATA_HDD) };
[0:50 pm, 09/09/2020] Amir Sultan UOL: void insertSSD ()
{ SDD_name.insert(element)};