Oct 13, 2015 at 6:36pm UTC
i cant find the problem
#include <iostream>
#include <Windows.h>
#include <iomanip>
using namespace std;
{
//start of program
int main;
int property value;
int percentage;
float percentage; (0.00)
cout << "please enter the property value -->";
cin >> property value;
cout <<"\n";
//calculation
percentage = ((property value / 100) * 80);
cout << "the insurance value is -->" << fixed << setprecision(2) << percentage;
cout << "\n";
system("pause");
return 0;
//End of program
}
im using visual studio
Oct 13, 2015 at 6:40pm UTC
int property value;
You can't have a variable name with space, change the name to int propertyValue;
Oct 13, 2015 at 7:08pm UTC
OK thank you, always helps with a fresh set of eyes.
Oct 13, 2015 at 7:27pm UTC
i still cant get it to work i get errors
Oct 13, 2015 at 7:39pm UTC
Instead of:
1 2 3 4
{
//start of program
int main;
// ...
Use:
When your compiler is giving you error messages and you want help resolving those,
supply the (first few) error messages. .
Last edited on Oct 13, 2015 at 7:40pm UTC
Oct 13, 2015 at 7:49pm UTC
where i have this bit
cout << "the insurance value is -->" << fixed << setprecision(2) << percentage ;
it says it is illegal for class
Oct 13, 2015 at 7:55pm UTC
Preferably the first actual error message including line number and not some paraphrased version that somehow manages to miss all the important parts. Also, if you update code, supply the updated version of the code that's causing the error.
It is important to supply the first error message as subsequent error messages may cascade from the first.
Last edited on Oct 13, 2015 at 7:57pm UTC
Oct 13, 2015 at 8:13pm UTC
ok the first one links back to my float value and gives me this error
Error 1 error C2371: 'percentage' : redefinition; different basic types c:\users\owen\documents\visual studio 2013\projects\property value\property value\property.cpp 14 1 property value
Oct 13, 2015 at 8:27pm UTC
i only have float percentage now i got rid of the int percentage
Oct 13, 2015 at 8:48pm UTC
all working now cheers for the help