//Ch3AppE03.cpp
//Calculates and displays a commission amount
//Created/revised by 1102640 on 1-19-08
#include %26lt;iostream%26gt;
First person that helps correct my error will get the ten points.
using std::cout;
using std::cin;
using std::endl;
int main()
{
//declare variables
double sales = 0.0;
double rate = 0.0;
double commission = 0.0;
//enter input items
cout %26lt;%26lt; "Enter the sales: ";
cin %26gt;%26gt; sales;
cout %26lt;%26lt; "Enter the commission rate: ";
cin %26gt;%26gt; rate;
//calculate commission
commission = sales * commission rate;
//display commission
cout %26lt;%26lt; "Your commission is: " %26lt;%26lt; commission %26lt;%26lt; endl;
return 0;
} //end of main function
I know the error is on the calcaulation line (28) but dunno what is wrong with it.
C++ error on line 28, Could you please tell me what is wrong with it? I'm new to C++?
commission = sales * commission rate;
You probably want:
commission = sales * rate;
Reply:what country are you from?
Reply:Variable commission rate is not declared!!
it should be
commission = sales * rate;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment