我试图为我的大学执行这个脚本
int main()
{
int x;
double y;
Provo:
cout<<"Vlera e X: ";
cin>>x;
switch(x)
{
case ((x)<(0.9)):
y=x*x;
break;
case (x==0.9):
y=2*x;
break;
case 'x>0.9':
y=x-3;
break;
}
cout<<"\n\n";
return 0;
}
这是代码,错误是:
17 10 ....\Untitled1.cpp [Error] 'x' cannot appear in a constant-expression
有人帮忙吗?