随笔- 75
文章- 0
评论- 2
阅读-
2522
04 2024 档案
输出
摘要:#include <iostream> #include <iomanip> using namespace std; int main (){ //保留3位有效数字?(四舍五入)->cout cout<<setprecision(3)<<3.004<<endl; //精确小数点3位? (四舍五入)
阅读全文
十进制转二进制
摘要:#include<bits/stdc++.h> using namespace std; int main(){ int n,s=1; cin>>n; while(n>0){ cout<<n%2; s++; n/=2; } return 0; }
阅读全文
double 函数
摘要:10/3 13/5=2.6 10%3=1 在C++怎么四舍五入 #include<iostream> #include <cmath> using namesapce std; int main (){ double i=round(13.0/5); cout<<i<<endl; return 0;
阅读全文