Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem!!!! Please respond!!

Whenever I use my Dev-C++ or any other compiler for that matter and I compile say:

#include

void main()
{
printf("Hello World
");
}

OR ANYTHING THAT I COMPILE
I get the output and then right after it On the same line it says please press a key to continue and no matter what i do it does it !!

It never used to do it could someone tell me what the problem is?

Thanks

Comments

  • CyberclawCyberclaw Member Posts: 10
    : I'm guessing that your program is ending and going
    : to a commandline prompt. You have nothing to keep
    : your program from ending in the example. Try adding
    : a line after:
    : printf("Hello World
    ");
    : to wait for a key press before it continues.
    : Hope this helps... TB


    Yeah all I had to do (I messed around untill i figured it out) is to do the following: (tell me what you think):

    #include
    #include
    #include

    int main()
    {
    printf("Hello World
    ");
    getche();
    system("CLS");
    system("PAUSE");
    system("CLS");
    getche();
    }

    and after that output ON A DIFFERENT PAGE IT WILL SAY please press a key to continue thats good enough for me!!!

    Well tell me what you think!

    Thanks

  • tburchamtburcham Member Posts: 102
    : : I'm guessing that your program is ending and going
    : : to a commandline prompt. You have nothing to keep
    : : your program from ending in the example. Try adding
    : : a line after:
    : : printf("Hello World
    ");
    : : to wait for a key press before it continues.
    : : Hope this helps... TB
    :
    :
    : Yeah all I had to do (I messed around untill i figured it out) is to do the following: (tell me what you think):
    :
    : #include
    : #include
    : #include
    :
    : int main()
    : {
    : printf("Hello World
    ");
    : getche();
    : system("CLS");
    : system("PAUSE");
    : system("CLS");
    : getche();
    : }
    :
    : and after that output ON A DIFFERENT PAGE IT WILL SAY please press a key to continue thats good enough for me!!!
    :
    : Well tell me what you think!
    :
    : Thanks


    That syntax didn't work in BC4.5. I modified it
    slightly to:[code]
    #include
    #include

    int main()
    {
    clrscr;
    printf("Hello World
    ");
    getche();
    return 0;
    }
    [/code]
    BC45 help says 'Do not use clrscr for Win32s or Win32 GUI applications.'... so better stick to your previous equiva-
    lents.
    By the way, I deleted my original reply because I actually
    have only experimented a little with C++. I am familiar with
    general programming concepts though, so I thought I'd try to
    help, then thought maybe I'd make it worse :).
    Anyway, good luck... tburcham

  • abcabc Member Posts: 443
    : Whenever I use my Dev-C++ or any other compiler for that matter and I compile say:
    :
    : #include
    :
    : void main()
    : {
    : printf("Hello World
    ");
    : }
    :
    : OR ANYTHING THAT I COMPILE
    : I get the output and then right after it On the same line it says please press a key to continue and no matter what i do it does it !!
    :
    : It never used to do it could someone tell me what the problem is?
    :
    : Thanks
    :

    try flushing stdout before exiting.
  • Andre YoungAndre Young USAMember Posts: 0

    _______ || http://forcoder.org || free video tutorials and ebooks about ( Delphi Python Visual Basic Ruby C++ JavaScript MATLAB Assembly R Objective-C C PL/SQL C# PHP Scratch Perl Visual Basic .NET Go Java Swift Lua Fortran Kotlin Prolog Ada F# Lisp Scala D COBOL VBScript Dart ABAP Julia Scheme FoxPro SAS Hack Alice Erlang Bash Transact-SQL Logo Rust Clojure ML Apex Awk Crystal LabVIEW ) ___________

Sign In or Register to comment.