I am new to both C++ and TextMate, and I'm running into a problem. When I run my extremely basic "programs" in TextMate using C++, it completely ignores the statement "cout >>" and just either ignores it, or inputs the maximum data value for the basic type I used.
What is going on, and how can I stop it?
The source code is as follows:
#include
int stonetolb(int);
int main() {
using namespace std;
int stone;
cout << "enter the weight in stone";
cin >> stone;
int pounds = stonetolb(stone);
cout << stone << "stone = ";
cout << pounds <<" pounds.";
return 0;
}
int stonetolb(int sts) {
return 14 * sts;
}
… and the output, regardless of whether or not I even try to put in a number is:
enter the weight in stone0stone = 0 pounds.
No comments:
Post a Comment