21 lines
479 B
C++
21 lines
479 B
C++
#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;
|
||
}
|