Arid Agriculture University, Rawalpindi: Mid Exam Spring 2021 (Paper Duration 12 Hours) To Be Filled by Teacher
Arid Agriculture University, Rawalpindi: Mid Exam Spring 2021 (Paper Duration 12 Hours) To Be Filled by Teacher
To be filled by Student
int a,b,result;
void add();
voidsub ();
};
int main() {
Arithmetic obj;
void add();
cout << "Enter the first num :";
cin >> obj.a;
cout << "Enter the second num :";
cin >> obj.b;
obj.result = obj.a + obj.b;
cout << obj.a << " + " << obj.b <<" = " <<obj.result<< endl;
void sub();
cout << obj.a << " - " << obj.b <<" = " <<obj.result<< endl;
return 0;
Question 2-
Solution-
#include<iostream>
using namespace std;
class Employee
{
int eid;
char ename[100];
float basic_salary, hra, da, i_tax, net_salary;
public:
void accept_details()
{
cout<<"\n Enter Employee Id : ";
cin>>eid;
cout<<"\n Enter Employee Name : ";
cin>>ename;
cout<<"\n Enter Basic Salary : ";
cin>>basic_salary;
}
void display_details()
{
cout<<"\n ----------------------- ";
cout<<"\n Employee Id : "<<eid;
cout<<"\n Employee Name : "<<ename;
cout<<"\n Basic Salary : "<<basic_salary;
}
};
int main()
{
Employee e;
e.accept_details();
e.display_details();
return 0;
}
#include <iostream>
#include<conio.h>
public://Access - Specifier
//Member Functions read() and print() Declaration
void read() {
//Get Input Values For Object Variables
cout << "Enter Name :";
cin >> name;
void sum() {
total = sub1 + sub2 + sub3;
avg = total / 3;
}
void print() {
//Show the Output
cout << "Name :" << name << endl;
cout << "Registration Number :" << regNo << endl;
cout << "Marks :" << sub1 << " , " << sub2 << " , " << sub3
<< endl;
cout << "Total :" << total << endl;
cout << "Average :" << avg << endl;
}
};
int main() {
// Object Creation For Class
StudentClass stu1, stu2;
getch();
return 0;
}