这个是程序
#include<stdio.h>
void main()
{
double x,y;
printf("Input x");
scanf("%lf",&x);
if(x<-1)
{
y=x^3-1;
printf("%lf",y);
}
else if(x<=1)
{
y=-3x+1;
printf("%lf",y);
}
else if(x<=10)
{
y=3e(2x-1)+5;
printf("%lf",y);
}
else
{
y=5*x+3*lg(2*x^2-1)-13;
printf("%lf",y);
}
这个是编译之后的提示
--------------------Configuration: 3 - Win32 Debug--------------------
Compiling...
3.cpp
D:\3.cpp(9) : error C2296: '^' : illegal, left operand has type 'double'
D:\3.cpp(14) : error C2059: syntax error : 'bad suffix on number'
D:\3.cpp(14) : error C2146: syntax error : missing ';' before identifier 'x'
D:\3.cpp(14) : warning C4552: '+' : operator has no effect; expected operator with side-effect
D:\3.cpp(19) : error C2021: expected exponent value, not '('
D:\3.cpp(19) : error C2059: syntax error : 'bad suffix on number'
D:\3.cpp(19) : error C2146: syntax error : missing ')' before identifier 'x'
D:\3.cpp(19) : error C2064: term does not evaluate to a function
D:\3.cpp(19) : error C2059: syntax error : ')'
D:\3.cpp(24) : error C2065: 'lg' : undeclared identifier
D:\3.cpp(24) : error C2296: '^' : illegal, left operand has type 'double'
Error executing cl.exe.
你这真心是小错误啊,自己定义数学运算符,未声明头文件,而且还缺个大括弧,我改了下,代码你对比下吧……