Program Closing

Discussion on Coding.
Post Reply
666666
Regular
Posts: 39
Joined: Thu Nov 24, 2005 1:14 pm

Post by 666666 »

Hope this is the relevant forum to post it in. Well, I've tested a Source code and compiled it. I also made a program out of it. Now the problem is, that everytime i press enter the window/program closes. Anyone know what's wrong? Here's the code


//--------------------------------------------------------------------
//
// op2_1.cpp
//

#include <iostream>
using namespace std;

int main()
{
cout << "Write X inches and I will find the answer in ";
cout << "X centimeters for you." << endl;
cout << "Write in X inches: ";
double tommer;
cin >> tommer;

const double antcmPrTomme = 2.54;

cout << tommer << " tommer = " << tommer * antcmPrTomme <<
" cm" << endl;
return 0;
}





please help me.

Thanks a lot
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Moved.
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

Code: Select all

//--------------------------------------------------------------------
//
// op2_1.cpp
//

#include <iostream>
using namespace std;

int main&#40;&#41;
&#123;
cout << "Write X inches and I will find the answer in ";
cout << "X centimeters for you." << endl;
cout << "Write in X inches&#58; ";
double tommer;
cin >> tommer;

const double antcmPrTomme = 2.54;

cout << tommer << " tommer = " << tommer * antcmPrTomme <<
" cm" << endl;
&#91;B&#93;system&#40;"pause"&#41;;&#91;/B&#93;
return 0;
&#125;
either insert that, or run from a command line, easiest ways
-><-
marleythe9
Loyal fan
Posts: 391
Joined: Sat Mar 26, 2005 12:41 am

Post by marleythe9 »

return 0; will close your program, or if ur debuging say press enter to close.
<img src='http://freewebs.com/trickro/70s.png' border='0' alt='user posted image' /><img src='http://freewebs.com/trickro/70s2.jpg' border='0' alt='user posted image' />
Post Reply