7 Years
Discussion Span
Last Post by Duoas

You're going to have to be a bit more specific. What display are you talking about? By "my C language program" do you mean your IDE or some code you have written?


You need to either run your program from the command prompt, or put some form of pause at the end of your program.

For example:

#include <iostream>
#include <limits>
using namespace std;

int main()
  // This is my program
  cout << "Hello world!\n\n\n";

  // This keeps the console window open on Windows.
  cout << "Press ENTER to quit." << flush;
  cin.ignore( numeric_limits <streamsize> ::max(), '\n' );

  return 0;

Personally, I recommend you get used to using the command prompt when working with console programs. On Windows, you can get to the command prompt by clicking Start, Run..., and typing "cmd". Then use the "cd" command to change to the directory where you compiled your program. Then type the name of your program and see it go.

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.