Write a C++ function named fracpart() that returns the fractional part of
any number passed to it. For example, if the number 256.879 is passed to fracpart(), the
number 0.879 should be returned. Have fracpart() call the whole() function you wrote in
Exercise 12. The number returned can then be determined as the number passed to
fracpart() less the returned value when the same argument is passed to whole(). The
completed program should consist of main() followed by fracpart() followed by whole().
#include <iostream>
#include <cmath>
using namespace std;
int whole(double);
double fracpart(double);
int main()
{
int whole(double x);
double x=0;
int y;
//cout << " Enter double precision number :\n";
//cin >> x;
y = x;
double z = (x - y);
cout <<"returned value"<< y << endl;
return y;
double fracpart(double num);
{
double x;
float fraction;
cout << " Enter double precision number :\n";
cin >> x;
fraction = whole(x) - (long)x;
cout <<" Answer is :"<< fraction <<endl;
return fraction;
}
char aaaa;
cin >> aaaa;
return 0;