Files
python/TangDou/XiTi/1005.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

21 lines
479 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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