Menu

executing code problems

2008-02-13
2012-09-26
  • shawn mcclure

    shawn mcclure - 2008-02-13

    I am just starting with this c++ program and i started by reading the help sections provided in the package. I worked my way through to the part where they give you a program to try out. A very easy one:

    include <stdio.h>

    int main()
    {
    printf("Hello World\n");
    return 0;
    }

    I put it in and saved it as a .c file, compiled it and tried to run it, just like they said to do in the help section. But the problem I'm having is after you hit the run button... Nothing happens, i figured a window would pop up with the 'Hello World' text like the program should do, but the only thing that happened was a very quick pop up black screen. It appears and disappears quickly and thats it. I have yet to see any successful program run, even though the program has no errors.
    I was just wondering if there was something i needed to download in order to view the running program.

     
    • derek mason

      derek mason - 2008-02-19

      Hah !
      My desktop's full of zombie windows anyway.
      They're called M$ Windows

       
    • Wayne Keen

      Wayne Keen - 2008-02-13

      Your exact question, how do you keep the display window open, and much more, can be found in the thread in this very forum titled 'Please Read Before Posting A Question'

      You will also want to check out the section on the 'basic 3'

      Wayne

       
    • aRTi S

      aRTi S - 2008-02-14

      Well, Try giving getch() before the return statement. Like this :

      include <stdio.h>

      int main()
      {
      printf("Hello World\n");
      getch();
      return 0;
      }

       I guess for the window to stay it needs to be asking you for a user input. This should work.
      

      -Arti

       
      • Wayne Keen

        Wayne Keen - 2008-02-15

        The user input is a means to an end.

        You see, the program does what it is supposed to do, and like me, at the
        end of the days work, it closes up shop and goes home.

        The input is simply a way of telling me, there's one more thing to do,
        wait for a phone call (or in the case of the program, and input).

        Wayne

         
    • cpns

      cpns - 2008-02-15

      Imagine an environment where a program's window was not closed by the operating system when the program terminated!? ... A desktop full of 'zombie' windows.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.