Code::Blocks Forums

User forums => Help => Topic started by: Analizer on April 01, 2012, 11:23:35 am

Title: Program closes straight after opening
Post by: Analizer on April 01, 2012, 11:23:35 am
Hello.

I started learning C++ about 2 or 3 days ago, learning from quite a few books. I created a simple converter from feet to metres.
It works fine in Code Blocks (after pressing F9) but when I find the .exe file in the folder, open it, write the feet amount and when I press Enter it converts but it closes straight after. So the window is only visible for less than half a second.

Any suggestions? 


Code
#include <iostream>

using namespace std;

int main()
{
    int     feet ;
    float   meters ;
    float   converter = 0.3048 ;

    cout << "Give the amount in feet: " ;
    cin >> feet ;

    meters = feet * converter ;

    cout << "\n" ;

    // ----- results
    cout << feet << " feet equals to "
         << meters << " meters \n" ;
    cout << " \n\n" ;
}
Title: Re: Program closes straight after opening
Post by: oBFusCATed on April 01, 2012, 11:32:54 am
Project -> Properties -> Build targets -> your target -> Pause when execution ends