Home > Back-end > Pay commission problem using a switch statement, there is no output in vs2017 but can run, to solve
Pay commission problem using a switch statement, there is no output in vs2017 but can run, to solve
Time:11-20
# include Int main () { Long double salary=0, basesalary=1000, appointed the=0, salesamount=0;//salary=basic salary + commission sales Long double sum1=0, sum2=0, sum3=0; int c; Lf scanf_s (" % ", & amp; Salesamount); C=salesamount/10000; The switch (c) { Case 0: Salary=basesalary; break; Case 1: If (c & lt; 2) { Appointed the=(salesamount - 10000) * 0.05; Salary=basesalary + themselves; Sum1=themselves; } break; Case 2: Case 3: Case 4: If (c & lt; 5) { Appointed the=sum1 + (salesamount - 20000) * 0.06; Salary=basesalary + themselves; Sum2=themselves; } break; Case 5: Case 6: Case 7: Case 8: Case 9: { If (c & lt; 10) { Appointed the sum2=sum1 + + (salesamount - 50000) * 0.07; Salary=basesalary + themselves; Sum3=themselves; } break; } Case 10: { Appointed the sum2=sum1 + + sum3 + (salesamount - 100000) * 0.08; Salary=basesalary + themselves; break; } Printf (" salary=% lf ", salary). return 0; } }//to run but no result
CodePudding user response:
The adjusted the code, you can run and as a result,