Classes With Primitive Data Members in OOPS in c++ how to implment Class Primitve Data Member

 

In these primitive data Member we use the void AREA::circle(int r) , void AREA::rectangle(int l,int b) function by using these function we can implement Classes with primitive Data Members in C++ programming OOPS
Source code in c++ Programming OOPS
#include<iostream.h>
#include<conio.h>
#define pi 3.14
class AREA
{
int area1,area2;
public:
void circle(int r);
void rectangle(int l,int b);
};
void AREA::circle(int r)
{
area1=pi*r*r;
cout<<"AREA OF THE CIRCLE : "<<area1;
}
void AREA::rectangle(int l,int b)
{
area2=l*b;
cout<<"AREA OF THE RECTANGLE : "<<area2;
}
void main()
{
int r,l,b;
clrscr();
AREA JJ;
cout<<"\nEnter the radius of the circle : ";
cin>>r;
JJ.circle(r);
cout<<"\n\nEnter the length & breadth of the rectangle : ";
cin>>l>>b;
JJ.rectangle(l,b);
getch();
}

OUTPUT c++ programming for oops
Enter the radius of the circle : 7
AREA OF THE CIRCLE : 153
Enter the length & breadth of the rectangle : 15 7
AREA OF THE RECTANGLE : 105

No comments:
Write comments
.sidebar .popular-posts ul {padding: 0;margin: 0;counter-reset: popcount;} .sidebar .popular-posts ul li {list-style: none !important;float: left;font-family:'Oswald',Arial,Tahoma,sans-serif;position: relative;width: 48%;height: 130px;overflow: hidden;margin: 2px;padding: 0 !important;border: 0;} .sidebar .PopularPosts .item-thumbnail {width: 100%;margin: 0;} .sidebar .PopularPosts ul li img {float: left;display: block;height: 130px;width: 100%;padding: 0;-webkit-transition-duration: 1.0s;-moz-transition-duration: 1.0s;-o-transition-duration: 1.0s;transition:1.0s;} .sidebar .PopularPosts ul li img:hover {overflow: hidden;transform:scale(1.06);-webkit-transform:scale(1.06);-moz-transform:scale(1.06);-o-transform:scale(1.06);} .sidebar .PopularPosts .item-title {position: absolute;right: 0;left: 0;bottom:0;padding-bottom: 0;z-index: 999;} .sidebar .PopularPosts .item-title a {display: block;padding: 5px 0px 2px 5px;background: rgba(32, 32, 32, 0.77);text-transform: capitalize;font-size: 12px;color: #fff;line-height: normal;transition: all .4s ease-in-out;} .sidebar .popular-posts ul li:hover .item-title a {background: rgba(231, 76, 60, 0.88);color: rgba(255, 255, 255, 1);text-decoration: none;} .sidebar .popular-posts ul li:before {counter-increment: popcount;float: left;position: absolute;content: counter(popcount, decimal);list-style-type: none;background: #e2e2e2;top: 0;font-size: 14px;color: #000;line-height: 20px;padding: 0px 8px 1px 1px;z-index: 4;border: solid #FFF;border-radius: 0px 0px 10px 0px;border-width: 0px 2px 2px 0px;}