I'm not sure what all errors I'm getting but I know the one with the equation called out in float, it tells me that asValue is undefined but with the one where it is defined in the float, I get these errors.
Call of nonfunction
Lvalue required
Call of nonfunction
I'm using Borland.
//Program assignment #4 Exercise 13 p.156 - Donald Black
#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
#include %26lt;iomanip.h%26gt;
void main()
{
float actualValue, asValue, oneHundred, propertyTax;
cout %26lt;%26lt; "What is the actual value of your propert? \n";
cin %26gt;%26gt; actualValue;
actualValue(.6) = asValue;
cout %26lt;%26lt; "Your property's assessment value is: " %26lt;%26lt; asValue;
propertyTax = asvalue(.0064)
cout %26lt;%26lt; "Your property tax is: \n";
cin %26gt;%26gt; propertyTax;
system ("pause");
}
Need help with this C++ program. Code provided. What is the solution to my problem?
I'm using Dev C++ but the code should be about the same.
1) You are missing a "using namespace std;" statement
2) Change "void main()" to "int main()"
3) If you are multiplying values, use a * not parentheses
4) You asValue variable is case sensetive, so this needs to be changed in your propertyTax = asValue * .0064; statement.
The new version of C++ calls for headers in the format of #include %26lt;iostream%26gt; there is no need for the .h (in Dev C++ anyway--if yours is different, you need only change it back). Also, there is no need for the conio include in this program.
Try this:
#include %26lt;iostream%26gt;
#include %26lt;iomanip%26gt;
using namespace std;
int main()
{
float actualValue, asValue, oneHundred, propertyTax;
cout %26lt;%26lt; "What is the actual value of your property? \n";
cin %26gt;%26gt; actualValue;
asValue = actualValue*.6;
cout %26lt;%26lt; "Your property's assessment value is: " %26lt;%26lt; asValue;
propertyTax = asValue*.0064;
cout %26lt;%26lt; "Your property tax is: \n";
cin %26gt;%26gt; propertyTax;
system ("pause");
}
Happy to see someone learning C++. I took it last semester; you will learn quickly.
Good luck
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment