#include using namespace std;

int main(){ float x,y; cout'请输入x的值:'; cin>>x; if(x>2 && x<=10){ y=x*(x+2); cout'y的值为:'<<y; } else if(x>-1 && x<=2){ y=2*x; cout'y的值为:'<<y; } else if(x<=-1){ y=x-1; cout'y的值为:'<<y; } else{ cout'输入有误!'; } return 0; }

C++ 程序:根据分段函数求 y 值

原文地址: https://www.cveoy.top/t/topic/l5n3 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录