this program is supposed to convert the weight in stones to lbs this is what i wrote:
// convert.cpp -- converts stone to pounds
#include <iostream>
int stonetolb(int); // function prototype
int main()
{
using namespace std;
int stone; // declaring our variable
cout << "enter the weigh of that crack rock: ";
cin >> stone;
int pounds = stonetolb(stone);
cout << "CRacK Rock = " << stone;
cout << pounds << " pounds of pure pleasure. " << endl;
return 0;
}
int stonetolb(int sts)
{
int pounds = 14 * sts;
return pounds;
}
program compiles with success but produces the following output:
The Debugger has exited with status 0.
[Session started at 2010-05-16 01:13:38 -0400.]
enter the weigh of that crack rock: 14
CRacK Rock = 14196 pounds of pure pleasure.
I created this program from a c++ book and the output is supposed to equal 196 so why is 14 being added to the front of that figure?