c/c++课的作业合集,都是很简单的文件。
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.
 
 
 
cpp-work/archive/20220302_2.cpp

21 lines
359 B

#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;
}