求高人帮忙编个程序吧.C++

来源:百度知道 编辑:UC知道 时间:2024/06/03 20:17:06
求Z的值.X Y的值由键盘输入
z=大括号2x+3y-100(x>=0,y>0)
3x-2y+100(x>=0,y<=0)
x*y(x<0)

帮楼上补充完整
#include <iostream>
using namespace std;

int main(int argc,char *argv[])
{
float x,y,z;
cout <<"please enter two numbers" <<endl;
cin >>x >>y;
if(x>=0 && y>0)
z=2*x+3*y-100;
else if(x>=0 && y<=0)
z= 3*x-2*y+100;
else
z=x*y;
cout <<"z=" <<z <<endl;
system("pause");
return 0;
}

#include<iostream>
using namespace std;
int main()
{
float x,y,z;
cout <<"please enter two numbers" <<endl;
cin >>x >>y;
if(x>=0&&y>0)
{
z=2x+3y-100;
cout <<"z=" <<z <<endl;
}
else
cout <<"numbers are false" <<endl;
return 0;
}