Thread: pause

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    33

    pause

    Ok, i created a hello world kinda thing and i wanted to try to add sum more strings.... how can i make the hello world pause because the only way i can veiw it at the moment is open a dos prompt. just running the .exe in windows.... it opens and closes real fast, im sure u expert C++ pll know what im talking about... hell im sure newbies that have made a hello program knows.. but anyways, whats the string i add to pause the window from closing when i open it. thanks
    this is my signature. k thx

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    there's getch(), getche(), getchar(), system("PAUSE") other means to do that.

    discussed often here. search for any of them for more detailed info or search your own compiler help.
    -

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    #include <iostream>
    
    int main()
    {
      std::cout<<"Hello, World!\n";
      std::cin.get();
      return 0;
    }
    -Prelude
    My best code is written with the delete key.

  4. #4
    Unregistered
    Guest
    Prelude: Just curious, why do you use the std::? Isn't it easier to put using namespace std at the top?

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Isn't it easier to put using namespace std at the top?
    Of course it's easier and certainly more convenient for the person writing the code. But is it safe? Is it secure? Can you guarantee that if you answered yes to either?

    Having a whole bunch of unnecessary clutter in the global scope has been repeatedly proven to be a mistake, so you should only do so if you have a very good reason. Convenience is rarely a good enough reason, so I restrict my code to local scopes as much as possible to avoid unforseen complications.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Fork(), pause(), and storing PID's in a linked list
    By vital101 in forum C Programming
    Replies: 10
    Last Post: 09-28-2007, 02:16 AM
  3. Dev-C++ Compile and Run with Pause
    By xmltorrent in forum C++ Programming
    Replies: 12
    Last Post: 03-29-2006, 11:55 PM
  4. pause program at console
    By datainjector in forum C# Programming
    Replies: 1
    Last Post: 03-27-2003, 12:36 AM
  5. Pause function ???
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 09-02-2001, 08:22 PM