You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
359 B
22 lines
359 B
3 years ago
|
#include <iostream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
void splitDouble(double x, int &n, double &f) {
|
||
|
n = (int) x;
|
||
|
f = x - n;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
cout << "Enter one double number:\n";
|
||
|
|
||
|
double x = 0;
|
||
|
cin >> x;
|
||
|
|
||
|
int n = 0;
|
||
|
double f = 0;
|
||
|
splitDouble(x, n, f);
|
||
|
|
||
|
cout << "Integer part=" << n << " Fraction Part=" << f;
|
||
|
}
|