can't get sample code to compile

Feb 22, 2010 at 2:08am
Here is some sample code out of a book that won't compile.. The error says that it can't find the "xxx.exe" file that I'm trying to compile/run.

[code]


#include <iostream>
using namespace std;
int stonetolb(int);
int main()
{
int stone;
cout << "Enter the weight in stone: ";
cin >> stone;
pounds = stonetolb(stone);
cout << stone << " stone are ";
cout << pounds << " pounds.\n";
return 0;
}

int stonetolb(int sts)
{
return 14 * sts;
}


[/code]



The output is suppose to be:

Enter the weight in stone: 14
14 stone are 196 pounds.
Feb 22, 2010 at 2:11am
Sorry.. The following is the right code out of the book..

#include <iostream>
using namespace std;
int stonetolb(int);

int main()
{
int stone;
cout << "Enter the weight in stone: ";
cin >> stone;
int pounds = stonetolb(stone);
cout << stone << " stone are ";
cout << pounds << " pounds.\n";
return 0;
}

int stonetolb(int sts)
{
return 14 * sts;
}
Feb 22, 2010 at 2:17am
I'm sorry.. I don't know what the problem was before, but it's working now... ; (
Feb 22, 2010 at 6:54pm
Looks fine to me lol
Feb 23, 2010 at 12:42am
EEVIAC, there's no point to bumping your thread every 3 minutes, someone will eventually respond, it may take 15mins it may take 6 hours.
Feb 23, 2010 at 12:48am
Or it might never happen. But when I see a bump I feel strongly unwilling to respond.
and @OP: You are using code tags wrong. Most tags don't nest; by bolding the tag you prevent it from wrapping your code. You can bold stuff in code tags but you can't bold the tags themselves.
Last edited on Feb 23, 2010 at 12:48am
Topic archived. No new replies allowed.