用C语言计算分段函数1、计算下列分段函数f(x,y)= 2x2+3x+1/x+y (x>=0,y>0)f(x,y)=2x2+3x+1/1+y2 (x>=0,y
问题描述:
用C语言计算分段函数
1、计算下列分段函数
f(x,y)= 2x2+3x+1/x+y (x>=0,y>0)
f(x,y)=2x2+3x+1/1+y2 (x>=0,y
答
#include "stdio.h"
#include
void main()
{
\x05double x,y,f,h;
\x05printf("请输入x:\n");
\x05 scanf("%lf",&x);
\x05printf("请输入y:\n");
\x05 scanf("%lf",&y);
\x05if((x>=0)&&(y>0))
\x05\x05f=2*pow(x,2)+3*x+1/x+y;
\x05else if((x>=0)&&(y