C++ 我的循环没有循环 在此处输入代码 #包括 #包括 使用名称空间std; int main() { 双职工人数=0.0;双职工总数=0.0; 双倍工时率=0.0;双倍总工时=0.0; 双倍工时=0.0;双倍总净付=0.0; 双平均工时=0.0;双平均工时=0.0; 双倍净付=0.0;双倍总预扣=0.0; 双重扣缴=0.0; 不能雇佣; 一小时之内; 工作时间; while(employeeNum!=9999) { 如果(工时>=40) { grossPay=工时*工时; 您的第二个条件可能与第一个条件重复((hoursWork>40);),并且条件末尾有一个分号。请在此处发布之前仔细检查语法 enter code here #include<iostream> #include<iomanip> using namespace std; int main() { double employeeNum = 0.0; double totalEmployees = 0.0; double hourlyRate = 0.0; double totalhoursWork = 0.0; double hoursWork = 0.0; double totalnetPay = 0.0; double grossPay = 0.0; double averagehoursWork = 0.0; double netPay = 0.0; double totalwithHoldings = 0.0; double withHoldings = 0.0; cout <<" Enter Employee Number or 9999 to Stop:"; cin >> employeeNum; cout <<"Enter hourly rate:"; cin >> hourlyRate; cout <<"Enter hours worked:"; cin >> hoursWork; while(employeeNum != 9999) { if (hoursWork >= 40) { grossPay= hoursWork * hourlyRate; cout <<" Gross Weekly Pay:" << grossPay << endl; } else (hoursWork > 40); { grossPay= hoursWork * hourlyRate*1.5; cout <<" Gross Weekly Pay:" << grossPay << endl; } while( grossPay > 1,000.00) { withHoldings= grossPay/ 0.28; } while( grossPay < 1,000.0) { withHoldings= grossPay/ 0.21; } netPay= grossPay-withHoldings; cout <<" Net Weekly Pay:" << netPay << endl; cout <<" Enter Employee Number or 9999 to Stop:"; cin >> employeeNum; cout <<"Enter hourly rate:"; cin >> hourlyRate; cout <<"Enter hours worked:"; cin >> hoursWork; } system("pause"); return 0; }

C++ 我的循环没有循环 在此处输入代码 #包括 #包括 使用名称空间std; int main() { 双职工人数=0.0;双职工总数=0.0; 双倍工时率=0.0;双倍总工时=0.0; 双倍工时=0.0;双倍总净付=0.0; 双平均工时=0.0;双平均工时=0.0; 双倍净付=0.0;双倍总预扣=0.0; 双重扣缴=0.0; 不能雇佣; 一小时之内; 工作时间; while(employeeNum!=9999) { 如果(工时>=40) { grossPay=工时*工时; 您的第二个条件可能与第一个条件重复((hoursWork>40);),并且条件末尾有一个分号。请在此处发布之前仔细检查语法 enter code here #include<iostream> #include<iomanip> using namespace std; int main() { double employeeNum = 0.0; double totalEmployees = 0.0; double hourlyRate = 0.0; double totalhoursWork = 0.0; double hoursWork = 0.0; double totalnetPay = 0.0; double grossPay = 0.0; double averagehoursWork = 0.0; double netPay = 0.0; double totalwithHoldings = 0.0; double withHoldings = 0.0; cout <<" Enter Employee Number or 9999 to Stop:"; cin >> employeeNum; cout <<"Enter hourly rate:"; cin >> hourlyRate; cout <<"Enter hours worked:"; cin >> hoursWork; while(employeeNum != 9999) { if (hoursWork >= 40) { grossPay= hoursWork * hourlyRate; cout <<" Gross Weekly Pay:" << grossPay << endl; } else (hoursWork > 40); { grossPay= hoursWork * hourlyRate*1.5; cout <<" Gross Weekly Pay:" << grossPay << endl; } while( grossPay > 1,000.00) { withHoldings= grossPay/ 0.28; } while( grossPay < 1,000.0) { withHoldings= grossPay/ 0.21; } netPay= grossPay-withHoldings; cout <<" Net Weekly Pay:" << netPay << endl; cout <<" Enter Employee Number or 9999 to Stop:"; cin >> employeeNum; cout <<"Enter hourly rate:"; cin >> hourlyRate; cout <<"Enter hours worked:"; cin >> hoursWork; } system("pause"); return 0; },c++,while-loop,C++,While Loop,要么条件为true,然后is保持为true,循环将永远循环,要么条件为true,语句永远不会执行 将while更改为if或在循环内修改grossPay 另外,不要在浮点常量中包含逗号。您的循环没有执行,因为您的浮点常量中有一个“,”。请使用1000.00而不是1000.00,因此当我更改它时,我应该使用if语句1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(35):错误C2181:如果1>e:\finalexamc++\fin

要么条件为true,然后is保持为true,循环将永远循环,要么条件为true,语句永远不会执行

while
更改为
if
或在循环内修改
grossPay


另外,不要在浮点常量中包含逗号。

您的循环没有执行,因为您的浮点常量中有一个“,”。请使用1000.00而不是1000.00

,因此当我更改它时,我应该使用if语句1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(35):错误C2181:如果1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(37):错误C2146:语法错误:缺少“;”在标识符“grossPay”1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(48)之前:错误C2146:语法错误:在标识符“扣留”之前缺少“;”==================重建所有:0成功,1失败,0跳过==========我认为家庭作业。对于软件工程师来说,调试是一项很好的天赋。@EdHeal+1,这是一项绝对必要的技能。@MartinJames-我同意,但不想直言不讳。您在fac中的循环非常循环t、 While循环可能不会退出,因为在循环1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(35)中没有修改check变量:错误C2181:如果1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(37),则没有匹配的else是非法的:错误C2146:语法错误:标识符“grossPay”1>e:\finalexamc++\finalexamc++\marquiswatkinsfinalexam.cpp(48)之前缺少“;”:错误C2146:语法错误:缺少“;”之前标识符“预扣”=====================重建全部:0成功,1失败,0跳过=============这是我修复错误时说的是我,或者这是期末考试,此人求助MB获得答案的想法有点令人担忧。希望他不是坐在我旁边。
while( grossPay > 1000.00)
        {
            withHoldings= grossPay/ 0.28;

        }