If you want
system("PAUSE"); You need to
#include <windows.h> .
What compiler/IDE/OS are you using? If you're using Visual Studio, press CTRL+F5 to run the program from a console with an automatic PAUSE in there.
If you're on windows without VS, press WIN+R, then type "cmd". use the
cd command to get to the output path of your compiler/linker. Then run the executable from there. The console will not pause.
I'm using NetBeans on windows 8 (don't hate).
I'd really like to learn just a simple bit of code that I can use just to keep the program open.
I get an error with the '# include <conio.h>' 'cannot find included file'
is Code::blocks an IDE or a Compiler? I use Netbeans as the IDE and Cygwin as the compiler?
Also is there no way to get this to work on NetBeans? I'm kinda getting used to the layout and dont want to start afresh.
Last edited on
It's both IDE and compiler ,I never use netbeans,I use MSVC but most Code::block because it has the bets IDE I beleive
No way to try and get this working on NetBeans?
The problem is that on line 13, your cin >> operation will leave extra input (the non integer information) in the buffer, so later on line 26 the ignore will obtain this input and ignore it.
The solution is to place another
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' ); after the lines where are you using formatted input (like line 13).
Just started using codeblocks and I'll think I'll stick with that for now.
Thank you for your help guys, really starting to get into programming, since I'm more of an electronic design guy :)