这是我的代码开始的地方。在代码的最底部,我将详细介绍错误点。
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
//declare variables
int usedWater = 0;
int prevReading = 0;
int currReading = 0;
const double WATER_RATE = .007;
const double MIN_CHARGES = 16.67;
double totalCharges = 0.0;
cout <<"enter the current reading: ";
cin >> currReading;
cout <<"enter the previous reading: ";
cin >> prevReading;
usedWater = currReading - prevReading;
totalCharges = usedWater * WATER_RATE;
if(totalCharges < MIN_CHARGES)
{
totalCharges = MIN_CHARGES << endl;
cout << "total charges: " << MIN_CHARGES;
}
else
{
cout << "Total Charges : " << totalCharges;
}
cout << "total Charges : " << totalCharges;
cout << "Used Water : " << usedWater;
system ("pause");
return 0;
}
第 36 行是我得到错误的地方。这个:(totalCharges = MIN_CHARGES << endl;)
我看不到任何拼写错误。或者可能是一些错误的词。