山东智趣岛论坛

标题: 判断 [打印本页]

作者: louyuxiang    时间: 2024-6-1 10:41
标题: 判断
本帖最后由 louyuxiang 于 2024-6-15 09:00 编辑

[C++] 纯文本查看 复制代码
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
        float n,t,m;
        cin>>n>>t;
        if(n>5 && t<=40){
                m=30*t;
        }if(n>5 && t>40){
                m=(t-40)*1.6+30*t;
        }if(n<=5 && t<=40){
                m=50*t;
        }if(n<=5 && t>40){
                m=(t-40)*1.6+50*t;
        }
    cout<<fixed<<setprecision(2)<<m<<endl;
}





欢迎光临 山东智趣岛论坛 (https://abc.sdzqd.com/) Powered by Discuz! X3.3