18.10.14

OOP : Excercise-4.1 : C++ program to find area of triangle, circle,and rectangle using function overloading

Write a C++ program to find area of triangle, circle,and rectangle using function overloading

OOP : Excercise-3 : C++ program to calculate simple interest amount use default value for rate

Write a C++ program using class to calculate simple interest amount use default value for rate.


//1. calculate simple interset in cpp
‪#‎include‬<iostream>
using namespace std;
main()
{
float SI=0,p,t,r;
cin>>p>>t>>r;
SI=((p*t*r)/100);
cout<<SI;
}


//2. calculate simple interest using function

‪#‎include‬<iostream>
using namespace std;
float interest(float p,float t,float r);
main()
{
float p,t,r,SI=0;
cin>>p>>t>>r;
interest(p,t,r);
}
float interest(float a,float b,float c)
{
float SI;
SI=((a*b*c)/100);
cout<<SI;
}


//3. calculate simple interest in oop. Use member variable and member function as required
‪#‎include‬<iostream>
using namespace std;
class interest
{
public:
float p,t,r;
void get_value()
{
cin>>p>>t>>r;
}
void cal_value()
{
float SI;
SI=((p*t*r)/100);
cout<<SI;
}
};
main()
{
interest in;
in.get_value();
in.cal_value();
}

OOP : Excercise-2 : calculate square and cube of given number using inline function

C++ program using class to calculate square and cube of given number using inline function .

Sample Syntax:

#include<iostream.h>
class power
{
public:
inline int square(int n)
{
 -----------------------------
 -----------------------------
 }
inline int cube(int n)
{
 -----------------------------
 -----------------------------
 }

};
void main()
{
 -------------------------------
 -------------------------------
}