Professional Documents
Culture Documents
Abubakar Mahboob Assign-1 Object Oriented Programming
Abubakar Mahboob Assign-1 Object Oriented Programming
Programming
Assignment-1
Abubakar Mahboob
Program#1:
Write a program that calculates the sum of three integer values, the sum of three float values as well
as the sum of two integer and one float value with the help of 3 functions with the same name
calculate. take all the from user.
Solution:
#include <iostream>
int main(){
cin>>num1>>num2>>x;
cin>>num3>>num4>> y;
cin>>x>>y;
return 0;
}
return a+b+c;
return a+b+c;
return a+b+c;
Output:
Solution:
#include<iostream>
class Shape
public: double a;
void get_data () {
cin>>a;
};
public:
void display_area () {
};
public:
};
int main(){
Circle t;
st->get_data();
st->display_area();
Square r;
sr->get_data();
sr->display_area();
return 0;
Output:
Enter the radius of Circcle: 2
Area of Circle : 12.56
Enter the number: 2
Area of Square: 4
Screenshot :