#include <iostream>
using namespace std;
int main(){
cout << 9/8 << 4*(6+3)%5 << (4*6+3)%5 << endl;
return 0;
}
#include <iostream>
using namespace std;
int main(){
cout << 15*3/2 << endl;
cout << 15*3/2.0 << endl;
return 0;
}
fixed << setprescision(8)
格式函数的作用。
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
cout << "9/8=" << 9/8;
cout << " 9.0/8=" << 9.0/8;
cout << " 9/8.0=" << 9/8.0;
cout << " 9.0/8.0=" << 9.0/8.0;
cout << endl;
cout << "10.0/6.0=" << 10.0/6.0 << endl;
cout << "10.0/6.0=" << fixed << setprecision(8) << 10.0/6.0 << endl;
return 0;
}