Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85451 王陈淼 11计算分段函数的值 C++ Compile Error 0 MS 0 KB 236 2024-07-17 16:28:07

Tests(0/0):


Code:

clude<iostream> using namespace std; int main(){ double x; cin >> x; if(x<5){ printf("%.3lf",-1*x+2.5); }else if(x<10){ printf("%.3lf",2-1.5*(x-3)*2); }else if(10<=x<20){ printf("%.3lf",x/2-1.5); } return 0; }


Run Info:

Main.cc:1:1: error: 'clude' does not name a type
 clude
 ^
Main.cc: In function 'int main()':
Main.cc:5:1: error: 'cin' was not declared in this scope
 cin >> x;
 ^
Main.cc:7:28: error: 'printf' was not declared in this scope
     printf("%.3lf",-1*x+2.5);
                            ^
Main.cc:9:33: error: 'printf' was not declared in this scope
     printf("%.3lf",2-1.5*(x-3)*2);
                                 ^
Main.cc:10:15: warning: comparison of constant '20' with boolean expression is always true [-Wbool-compare]
 }else if(10<=x<20){
               ^
Main.cc:10:12: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
 }else if(10<=x<20){
            ^
Main.cc:11:27: error: 'printf' was not declared in this scope
     printf("%.3lf",x/2-1.5);
                           ^