# Dev C++ Code Closes Out



## GrandslammerBD (Feb 22, 2008)

I am currently using Dev C++ as my current compiler. The issue im experiencing is whenever im programming a code that involves any sort of user interaction, after the code is compiled I execute it and I type in a character and hit enter and than the window closes. Im not sure what the problem is. Can you help me out???


----------



## dm01 (Oct 10, 2006)

Moved here for better support.

Post your code in

```
tags.
```


----------



## shuuhen (Sep 4, 2004)

Sounds like you're writing a command line program on Windows. One method around this is to open a command prompt, navigate to the executable then run the executable from within the command window. Another is to set a breakpoint at the end of your main function where you have a line like "return 0;" (assuming C/C++ code) and run in debug mode. Neither method introduces platform dependant code, relies unnecessarily on external programs or adds unnecessary situational code, so I recommend them over adding special code to pause.

If this isn't the case, we'll need more information. An example program is preferred (like dm01 said - in code tags).


----------



## GrandslammerBD (Feb 22, 2008)

HERE IS MY CODE:


/**
* @author Scott Linske
* @version 12/5/09
* Code Description: Converts temperature to Celsius from the fahrenheit temperature provided by the user
*/

#include <iostream> //Allows user interaction with program
using namespace std; //Introduces using namespace std;

void Temperature(); //Prototype or the function Temperature();
//pre:
//post: Converts temperature to Celsius from the fahrenheit temperature provided by the user
void Temperature() //Definition for the function Temperature()
{
//Declares variables fahrenheit and celsius
int Fahrenheit;
int Celsius;

//Prompts the user for the temperature in fahrenheit
cout<<"Enter the temperature in fahrenheit:";
cin>>Fahrenheit;

//Computes the temperature in celsius from the fahrenheit temperature provided by the user
Celsius=(Fahrenheit-32)*5/9;

//Outputs the temperature in celsius from the fahrenheit temperature provided by the user
cout<<Celsius<<" "<<"Degrees Celsius"<<endl;

}
int main() //Starting point of execution
{
Temperature(); //function call to Temperature();, int main() is on hold

return 0; //End of execution
}


----------



## GrandslammerBD (Feb 22, 2008)

i found the issue. I just added system("pause") right before the return 0; 
and it solved my problem!!! Thanx for the help!!!


----------

