急求这个用C++代码编写的完整程序。谢谢

2025-02-26 04:08:03
推荐回答(4个)
回答1:

//得到价格 fValue为原价
float GetPrice( float fValue)
{
if( fValue <= 100.0f)
return fValue * 0.95f;
else
{
if( fValue <= 1000)
return fValue * 0.9f;
else
return fValue * 0.85f;
}
}

回答2:

double k;//原价
double price;//价格
//输入方式可为  std::cin>>k;
if(k<=100) price=k*0.95;
else if(k<1000) price=k*0.9;
else price=k*0.85;

//输出可为 std::cout<

回答3:

你得先说出完整的需求,然后才能给你解答

回答4:

你这不写出来了么?