Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
96480 张运衡 11计算分段函数的值 C++ Compile Error 0 MS 0 KB 304 2024-11-09 10:19:49

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ double x; cin>>x; if(-x<=0&&5>-x){ printf("%.3lf",-x+2.5); } else if(-x<=5&&10>-x){ printf("%.3lf",2-1.5*(-x*3)*2); } else if(-x<=10&&20>-x){ printf("%.3lf",-x/2-1.5); } y=x; cout<<y; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:2: error: 'y' was not declared in this scope
  y=x;
  ^