谁能解释为什么它在“else”之后显示预期的表达式错误?我以为我做的一切都是对的。
谢谢你
#include <iostream>
using namespace std;
int main()
{
double x; // number of hours work per week
double z; //grosspay
double w; //withholding amounts
double n; //net pay
int y; // number of dependents
cout<<"how many hours do you work in a week?"<<endl;
cin >> x;
if(x<=40)
if(y<3)
z = 16.78*x;
w = 0.06*x+0.14*x+0.05*x+10;
n = z-w;
cout<< "the grosspay is"<< z <<endl
<<" the withholding amount is"<< w <<endl
<<" the netpay is" << n <<endl;
else---------------------------------------------------------expected expression error
z= 16.78x;
w= 0.06*x+0.14*x+0.05*x+10+35;
n=z-w;
cout<< "the grosspay is"<< z <<endl
<<" the withholding amount is"<< w <<endl
<<" the netpay is" << n <<endl;
if(x>40)
if(y<3)
z= 16.78*40+(x-40*16.78);
w= 0.06*x+0.14*x+0.05*x+10;
n=z-w;
cout<< "the grosspay is"<< z <<endl
<<" the withholding amount is"<< w <<endl
<<" the netpay is" << n <<endl;