多分支if求分段函数若x>5,则y=x+3;若0<=x<=5,则y=0;若x<0,则y=2*x+30;#include<iostream.h>void main(){ int x, y; cout<<"输入x="; cin>>x; if(x>5) y=x+3; else if(5>=x&&x>=0) y=0; else if (x<0) y=2*x+30; cout<<"y="<<y<<endl; }