-
Notifications
You must be signed in to change notification settings - Fork 0
/
RealAndIntegerSeperater.cpp
59 lines (55 loc) · 1.33 KB
/
RealAndIntegerSeperater.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Program to Seperat real and integer part
#include<iostream>
using namespace std;
class Seprater
{
private:
float numb;
float integer;
int real;
public:
Seprater() //Default Constructor
{
float number;
cout<<"Enter the number => ";
cin>>number;
numb = number;
Seprate();
}
Seprater(float N) //Parametrized Constructor
{
numb = N;
Seprate();
}
Seprater(Seprater &object) //Copy Constructor
{
numb = object.numb;
integer = object.integer;
real = object.real;
}
void Seprate() // Member Function
{
real = numb;
integer = numb - real;
}
void Show() // Member Function
{
cout<<"The Real Part => "<<real<<endl;
cout<<"The Integer Part =>"<<integer<<endl;
cout<<"*****************************************************************"<<endl;
}
~Seprater()
{
}
};
int main()
{
float number;
cout<<"Enter the number => ";
cin>>number;
Seprater num1, num2(number), numb3(num2);
num1.Show();
num2.Show();
numb3.Show();
return 0;
}