除了 else 部分之外的所有内容都给了我一个奇怪的(预期的主要表达式在 else 之前)错误。IM认为这可能与逻辑的局限性有关。但我似乎无法解决这个错误。
#include <iostream>
using namespace std;
int main()
{
int numberRegistered = 0;
const double feePerOneThroughFour = 0.0;
const double feePerFiveThroughTen = 0.0;
const double feeElevenOrMore = 0.0;
double moneyOwed = 0.0;
cout << " Enter in the Number of Registered people";
cin >> numberRegistered;
if (numberRegistered <= 0 );
{
cout << " You have entered in either the number 0 or a negative number" ;
}
else
if (numberRegistered == 1 ) || (numberRegistered == 2) || (numberRegistered == 3 ) || (numberRegistered == 4)
moneyOwed = numberRegistered * feePerOneThroughFour;
cout << " Money Owed : $ " ;
cin >> moneyOwed ;
else if (numberRegistered == 5 ) || (numberRegistered == 6) || (numberRegistered == 7 ) || (numberRegistered == 8) || (numberRegistered == 9) || (numberRegistered == 10)
moneyOwed = numberRegistered * feePerFiveThroughTen;
cout << " Money Owed : $ " ;
cin >> moneyOwed ;
else if (numberRegistered >= 11)
moneyOwed = numberRegistered * feeElevenOrMore;
cout << " Money Owed : $ " ;
cin >> moneyOwed ;
system("pause");
return 0;
}