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.

21 lines
479 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
//C方法
printf("%.2f", 1.0 * a / b);
//换行看的更清楚
cout << endl;
//C++方法:
// setiosflags(ios::fixed)是指以固定的浮点显示
// 当setiosflags(ios::fixed)和serprecision(n)两个一起用时就表示保留n位小数输出
cout << setiosflags(ios::fixed) << setprecision(2) << 1.0 * a / b;
return 0;
}