i use dev c++ and TC++ for learning c++ some codes , when i want to run them , they just flush, doesnt show any output, a consol window flashes. i can see the output at second's flash, how do i help it? here is a sample code that shows the same issue; Code: #include <iostream.h> #include <conio.h> int main() { cout << "Hi!\n"; return 0; getch(); }
use cin.ignore() after. instead of getch() is what i do. it closes right after the output thats why it flashes. it shows the hi then it closes. you can also use getchar() from the cstdlib library which would prolly be the best thing to use.
also anything after return 0; in this case will not be run, as return 0; ends the program in this case. You should also use "iostream" instead of iostream.h as iostream.h is old and pre standard c++. include iostream and then have using namespace std; under it , and that will be fine for little educational programs such as this.
tc++ is HORRIBLY OUTDATED , it has been written before the first c++ standard came out so I'd advise strongly against using it Dev-C++ however is based upon GCC one of the most compliant compilers around (there are some compilers that claim to be more compliant but those are commercial Comeau or Intel to name a few) and it's free