when any console application finishes in c++ it types "press any key to continue ... " and it waits me to press any key to close
what should i do if i want to colse my console without showing this phrase and without press any key to close it thnx in advace
The usual problem is that the console program closes too soon, before the user has any chance to read what is on the screen.
If the program stays open with the message "press any key to continue ... " even when you run it from the command line, it must be because there is some code in the program causing that to happen. All you need to do is to remove that code, and recompile.
But if you run the program from within the IDE, the message could come from the IDE, rather than the program itself.
Well, I'm not using visual studio, so I'm giving second-hand information here. But it seems that pressing ctrl-f5 is the cause of the "press any key" message.
But, as I suggested previously, you can close the visual studio program and directly run your program. That should get rid of the unwanted message. That is, double-click on the executable as you would any other program. The executable will probably reside within a sub-folder, it might have a name such as release or debug or something like that.
if you didnt put "press any key to continue ... " in your program, then it is the result of the IDE, not your program. It is for development use, same as some IDE's show execution time, etc. Running your program from terminal or command prompt (if your on windows) will execute your program without the IDE's extra info.
for example in linux: sudo vim main.cpp (using vim to create the file) g++ main.cpp -o main (compiles main.cpp to main) ./main (runs main in same directory)
This method is terminal only, no IDE, so therefore no IDE extra info is displayed along with the program. And i am sure windows is similar just different commands