2

I am using Code::Blocks for programming in C. When I compile my program and execute it, the output window (i.e.. Windows Command prompt) displays some execution related text, these texts are not of use to me right now and dont want them to appear(see text below).

Hello, World!
Process returned 0 (0x0) execution time : 3.920 s
Press any key to continue.

I tried to change the settings in Code::Blocks but couldn't find any settings related to the output window and also I dont want the text "Press any key to continue" to appear. These texts appear only if I run the program through Code::Blocks and doesn't appear if I directly run the program.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
jNerd
  • 181
  • 3
  • 11
  • And don't add tags for different&unrelated languages. The text is likely from your IDE. What is the problem with it? As you say, it does not appear when run outside the IDE, so what? – too honest for this site Mar 26 '16 at 15:50
  • @Olaf Yes the text might be from the IDE and I dont want them to appear, how can I make those texts not to appear? – jNerd Mar 26 '16 at 15:53
  • 1
    Obviously by not running your program from the IDE. An IDE is used for development, but the idea of writing a program is to run it stand-alone after that. – too honest for this site Mar 26 '16 at 16:08

3 Answers3

2

Unfortunately, some things just cannot be changed, and that is one of them. There are some quirks used by some IDE's that just drive programmers crazy, but it can't be helped. There is a reason why it's there: the execution data can be used to find out whether the program worked properly (e.g. ended execution). You can use this data later when targeting execution time as one of the main focuses in coding the project. There may be other uses for it as you code more and more advanced projects.

1

It only appears when you execute your code from the compiler. It does not need getch() function to stop the screen.

But if you execute its .exe file directly, outside the compiler, you will notice that annoying message 'Process returned 0 (0x0) execution time : 3.920 s' doesn't show anymore. Moreover, you will need getch() function to stop the screen.

yourson
  • 88
  • 1
  • 4
  • 18
1

you may need to include stdio.h and then call getchar() before return 0 for example;

#include <iostream>
//add this library
#include <stdio.h>
using namespace std;
int main()
{
    cout<<"I am a C++ programmer! "<<"Awesome!";
    //add this line of code
    getchar();
    return 0;
}
Dismas
  • 377
  • 1
  • 3
  • 10