dev-cpp premature closing
Posted: Mon Nov 22, 2010 11:40 am
ive started learning c++ and came across this problem which i got over:)
using a c++ tutorial doing exactly as said didnt let you see the results in dev-cpp, the window flashed then closed right away.
original(window closing code)
this code just made the exe flash after it being compiled and linked. but i found out how to fix it.
use
in the source as shown here...
now the window will stay open untill you close it.
for anyone who has the same problem while learning
NOTE: I know that <iostream.h> is outdated and is just <iostream> now but still works with dev-cpp and this is what the tutorial is saying so im going with what it is saying for now.
using a c++ tutorial doing exactly as said didnt let you see the results in dev-cpp, the window flashed then closed right away.
original(window closing code)
Code: Select all
#include <iostream.h>
int main()
{
cout << "Hello world\n";
return 0;
}
use
Code: Select all
#include <cstdio> and getchar()
Code: Select all
#include <cstdio>
#include <iostream.h>
int main()
{
cout << "Hello world\n";
getchar();
return 0;
}
for anyone who has the same problem while learning
NOTE: I know that <iostream.h> is outdated and is just <iostream> now but still works with dev-cpp and this is what the tutorial is saying so im going with what it is saying for now.