RE: [Dev-C++] Newbie: Error in IOSTREAM declaration
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <Rei...@at...> - 2003-09-29 19:28:24
|
#inlcude <cstdlib> -> include not inlcude
reid
> -----Original Message-----
> From: Opacki, Joseph [mailto:Jos...@ng...]=20
> Sent: Monday, September 29, 2003 9:46 AM
> To: 'dev...@li...'
> Subject: [Dev-C++] Newbie: Error in IOSTREAM declaration
>=20
>=20
> I'm new to this, can someone help we pinpoint the error?
>=20
> Thanks...Joe
>=20
> ***ERROR***
> 2 C:\compile\compile.cpp:3 invalid preprocessing directive
> #inlcude
>=20
> ***CODE***
> // program to compute bill for either a wholesale or retail=20
> purchase #include <iostream> #inlcude <cstdlib>
>=20
> using namespace std;
>=20
> const double TAX_RATE =3D 0.05; // 5% sales tax
>=20
> int main()
> {
> char salesType, ans;
> int number;
> double price, total;
> =20
> 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;
> =20
> if ( (salesType =3D=3D 'W') || (salesType =3D=3D 'w') )
> {
> total =3D price * number;
> } else if ( (salesType =3D=3D 'R') || (salesType =3D=3D 'r') )
> {
> double subtotal;
> subtotal =3D price * number;
> total =3D subtotal + subtotal * TAX_RATE;
> } else
> {
> cout << "Error in input" << endl;
> }
> =20
> cout.setf(ios::fixed);
> cout.setf(ios::showpoint);
> cout.precision(2);
> =20
> cout << number << "items at $" << price << endl;
> cout << "Total Bill =3D $" << total;
> =20
> if ( (salesType =3D=3D 'R') || (salesType =3D=3D 'r') )
> {
> cout << " including sales tax.\n";
> }
> =20
> cout << endl << "Would you like to try again (Y or N)? ";
> cin >> ans;
> cout << endl;
> } while (ans =3D=3D 'y' || ans =3D=3D 'Y');
> =20
>=20
> system("pause");
> return 0;
> }
>=20
>=20
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf=20
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
|