2 things.
Change :
namespace std; to using namespace std; . Your code shouldn't compile without changing it.
then change:
int Meters;
int Yards;
to:
double Meters;
double Yards;
Int can only be integer values So: 1, 4 , 300, 5632 etc etc.
But you need some digits after the comma, so you need the double data-type
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
The mistake is that you are using integers (the set 0,1,2,3 and -1 etc)
to represent floating point number.
int a=2*1.2;
gives sets a to 2.
write
double Meters;
double Yards;
instead of the two int declarations.
StuXYZ
Practically a Master Poster
680 posts since Nov 2008
Reputation Points: 760
Solved Threads: 138