Quick question about c++ and command promp

Discussion in 'Programming' started by mohamedd, Feb 25, 2009.

  1. #1
    I have recently started learning about C++ and have started to make a few programs that are simple and run in command promp.

    My question is that every time the program has finished what it is intended to do it exists out, a bit annoying. so how can i make it (as in what code) so it will not exist out but go right to begening again.

    Thank alot!
     
    mohamedd, Feb 25, 2009 IP
  2. Ancient Dragon

    Ancient Dragon Peon

    Messages:
    192
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    just code a loop
    
    int main()
    {
        for(;;) // infinite loop
        {
            cout << "Hello World\n";
        }
    }
    
    Code (markup):
     
    Ancient Dragon, Feb 25, 2009 IP
  3. nirajkum

    nirajkum Active Member

    Messages:
    815
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    why do u want that .... it will go into infinite loop even if u want .. put getch() statement in ur c++ program
     
    nirajkum, Feb 25, 2009 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4
    besides getch() is part of conio.h remember to include it in start

    #include <conio.h>
     
    Vooler, Feb 27, 2009 IP
  5. A.O.C

    A.O.C Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    any 1 wana tel me how can i hack linksys modem password...
    please some 1 tell me coz im using wirlees i have only 1 connection dat s lock
     
    A.O.C, May 6, 2009 IP
  6. kamlesh_a

    kamlesh_a Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi,
    I am a beginner of C++.Getting quite confused with arrays & polymorphism.can someone guide me with examples.If possible tell me some reference books or give me links which would be helpful in learning c++ .
    Regards & Thanks,
    Kamlesh.
     
    kamlesh_a, May 6, 2009 IP
  7. MayurGondaliya

    MayurGondaliya Well-Known Member

    Messages:
    1,233
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    170
    #7
    For infinite loop, you may also use this.

    while(1)
    {
    //your statements
    }
     
    MayurGondaliya, May 6, 2009 IP