从键盘输入t的值 根据上图公式 计算并打印y的值
要求 使用swich语句 输出时小数点后输出3位 根据提示 在最上面编辑器补充代码
#include <stdio.h>
int main()
{
float t,y;
scanf("%f",&t);
if (t>=0 && t<3)
{
switch((int)t)
{
case 0:
y = t*t;
break;
case 1:
y = t*t-1;
break;
case 2:
y = t*t -2*t +1;
break;
}
printf("%.3f",y);
}else
printf("Out of definition domain!\n");
return 0;
}