[Dev-C++] Newbie: Error in IOSTREAM declaration
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Opacki, J. <Jos...@ng...> - 2003-09-29 15:43:24
|
I'm new to this, can someone help we pinpoint the error?
Thanks...Joe
***ERROR***
2 C:\compile\compile.cpp:3 invalid preprocessing directive
#inlcude
***CODE***
// program to compute bill for either a wholesale or retail purchase
#include <iostream>
#inlcude <cstdlib>
using namespace std;
const double TAX_RATE = 0.05; // 5% sales tax
int main()
{
char salesType, ans;
int number;
double price, total;
do
{
cout << "Enter price $";
cin >> price;
cout << "Enter number purchased: ";
cin >> number;
cout << "Type W if this a wholesale purchase.\n"
<< "Type R if this a retail purchase.\n"
<< "Then press Return.\n";
cin >> salesType;
if ( (salesType == 'W') || (salesType == 'w') )
{
total = price * number;
} else if ( (salesType == 'R') || (salesType == 'r') )
{
double subtotal;
subtotal = price * number;
total = subtotal + subtotal * TAX_RATE;
} else
{
cout << "Error in input" << endl;
}
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << number << "items at $" << price << endl;
cout << "Total Bill = $" << total;
if ( (salesType == 'R') || (salesType == 'r') )
{
cout << " including sales tax.\n";
}
cout << endl << "Would you like to try again (Y or N)? ";
cin >> ans;
cout << endl;
} while (ans == 'y' || ans == 'Y');
system("pause");
return 0;
}
|