本文介绍了帮助解决C ++错误!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我一直收到此错误: 错误C2143:语法错误:缺少';'之前'}' #include < iostream > #include < fstream > #include < iomanip > 使用 命名空间标准; int main( int argc, const char * argv []) { ifstream input; input.open( text.txt); int employeeid,numberofemployees; float 每小时,毛钱,工作时间,税务,netpay; float taxrate = 0 ; char taxstatus [ 2 ]; numberofemployees = 0 ; while (输入>> employeeid>> hoursworked>> hourlyrate>> taxstatus){ grosspay = hoursworked * hourlyrate; 如果(grosspay> 1000 )taxrate = 0 。 30 ; 其他 如果(grosspay> 800 )taxrate = 0 。 20 ; 其他 如果(grosspay> 500 )taxrate = 0 。 10 ; else taxrate = 0 。 0 ; ifstream输入; if ((((strcmp(taxstatus, H)== 0 ))||((strcmp(taxstatus, h)== 0 )))&&(grosspay> 500)){ taxrate = taxrate - 。 05 ; } ifstream输入; if ((((strcmp(taxstatus, S)== 0 ))||((strcmp(taxstatus, s)== 0 ))){ taxrate = taxrate - 。 05 ; } ifstream输入; if (((((strcmp (taxstatus, M)== 0 ))||((strcmp(taxstatus, m)== 0 ))){ taxrate = taxrate - 。 05 ; } taxamount = grosspay * taxrate; netpay = grosspay-taxamount; cout<< 员工ID为:<< employeeid<< endl; cout<< 工作时间为:<< hoursworked<< endl; cout<< 每小时费率为:<< hourlyrate<< ENDL; cout<< 总收入是:<< grosspay<< ; ENDL; cout<< TAXAMOUNT IS:<< TAXAMOUNT<< ENDL; cout<< NET PAY是:<< netpay<< ENDL; } input.close(); system( pause); return 0 ; } 解决方案 I keep getting this error:error C2143: syntax error : missing ';' before '}'#include <iostream>#include <fstream>#include <iomanip>using namespace std;int main(int argc, const char * argv[]){ifstream input;input.open("text.txt");int employeeid, numberofemployees;float hourlyrate, grosspay, hoursworked , taxamount, netpay;float taxrate=0;char taxstatus[2];numberofemployees=0;while (input>>employeeid>>hoursworked>>hourlyrate>>taxstatus){grosspay = hoursworked*hourlyrate;if (grosspay > 1000) taxrate= 0.30;else if (grosspay > 800 ) taxrate= 0.20;else if (grosspay > 500) taxrate = 0.10;else taxrate=0.0;ifstream input;if ((((strcmp(taxstatus, "H")==0))||((strcmp(taxstatus, "h")==0))) && (grosspay>500)){taxrate=taxrate-.05;}ifstream input;if ((((strcmp(taxstatus, "S")==0))||((strcmp(taxstatus, "s")==0))){taxrate=taxrate-.05;}ifstream input;if ((((strcmp(taxstatus, "M")==0))||((strcmp(taxstatus, "m")==0))){taxrate=taxrate-.05;}taxamount=grosspay*taxrate;netpay=grosspay-taxamount;cout<<"THE EMPLOYEE ID IS:"<< employeeid<<endl;cout<<"THE HOURS WORKED ARE:" <<hoursworked<<endl;cout<<"THE HOURLY RATE IS:"<< hourlyrate<<endl;cout<<"THE GROSS PAY IS:" <<grosspay<<endl;cout<<"THE TAXAMOUNT IS:"<< taxamount<<endl;cout<<"THE NET PAY IS:"<< netpay<<endl;}input.close();system("pause");return 0;} 解决方案 这篇关于帮助解决C ++错误!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-11 20:20