编写一个c++程序,求绝对值x+绝对值y的值,式中x和y均从键盘输入

如题所述

第1个回答  2018-10-20
#include<iostream.h>
fun( double x){
if( x<0) return x;
if(10<=x&&x<=50) return 3*x-2;
if(50<=x&&x<=100) return 4*x-1;
if(x>=100) return 5*x;
return 0;
}
int main(){
double x;
cin>>x;
cout<<fun(x);
return 0;
}本回答被网友采纳
相似回答