#include <bits/stdc++.h> using namespace std; int main(){ //保留3位有效數字?(四捨五入)-> cout cout<<setprecision(3)<<3.004<<endl; //精確小數點後三位(四捨五入) -> cout cout<<fixed<<setprecision(3)<<3.0135<<endl; //精確小數點後三位(四捨五入) -> printf //int %d float %f double %lf char %c string %s printf("%1.3f\n%1.3f\n%s",3.0015,3.0049,"45612348"); cout<<1111<<"\n"<<2222;//\n 換行符 return 0; }