2026.10.6 编程作业

include

#include 如果要使用四舍五入 这一行代码必须加入
using namespace std;

int main(){
double C;
double F;
cin>>F;
C=5*(F-32)/9;
** cout<<fixed<<"摄氏温度="<<setprecision(2)<<C<<endl;** 其中fixed 和setprecision(n)就是固定保留n位小数的必须语言
return 0;
}

include

using namespace std;
int main(){
int a;
cin>>a;
if(a>=0 && a<=100) 翻译为a大于等于0且小于等于100 不能用0<=a<=100有逻辑错误
{
cout<<1<<endl;
}
else{
cout<<0<<endl;
}
if(a>=60)
{
cout<<1<<endl;
}
else{
cout<<0<<endl;
}
return 0;
}

posted @ 2026-10-06 19:22  brown成  阅读(3)  评论(0)    收藏  举报