DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Annoying Problem

  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Annoying Problem with Dev-Cpp

    I'm having a bit of a problem getting the programs im writing after I compile them (with Bloodshed Dev-C++) to stay open. When I compile the code then run the program a window just flashes up on the screen really fast and I can't even tell if anything is being written in the window. Heres the code im trying to run:

    Code:
    #include <iostream>
    using namespace std;
    
    int main ()
    {
      cout << "Hello World! ";
      cout << endl;
      return 0;
    }
    This is really frustrating! Thanks in advance for any help.
    Last edited by AdamL; 10-08-2006 at 09:17 PM.

  2. #2
    Join Date
    Aug 2005
    Location
    Melbourne...Australia
    Posts
    279
    If you add cin.get(); this will stop the window from closing..
    Code:
    #include <iostream>
    using namespace std;
    
    int main ()
    {
      cout << "Hello World! "<<endl;;
      cin.get();
      return 0;
    }

  3. #3
    Join Date
    Sep 2006
    Posts
    14
    One more way,

    you can use 'system ("pause")' method to pause the screen.

    here is the code

    #include <stdlib.h>
    #include <iostream>
    using namespace std;

    int main ()
    {
    cout << "Hello World! "<<endl;;
    system("pause");
    return 0;
    }

  4. #4
    Join Date
    Aug 2005
    Location
    Melbourne...Australia
    Posts
    279
    Quote Originally Posted by venkat78
    One more way,

    you can use 'system ("pause")' method to pause the screen.

    here is the code

    #include <stdlib.h>
    #include <iostream>
    using namespace std;

    int main ()
    {
    cout << "Hello World! "<<endl;;
    system("pause");
    return 0;
    }
    I dont agree with this method, while it will still work it is non standard, compuationally expensive and will only work in a windows environment..

    Also <stdlib.h> has been replaced with <cstdlib>..

    Regards
    Code

Similar Threads

  1. Problem with Search
    By Irina in forum ASP.NET
    Replies: 0
    Last Post: 11-29-2002, 11:47 PM
  2. Replies: 0
    Last Post: 12-13-2001, 01:06 PM
  3. a problem with font and language
    By Roseta in forum VB Classic
    Replies: 0
    Last Post: 11-14-2001, 04:24 AM
  4. Arabic problem view
    By Ayman in forum VB Classic
    Replies: 0
    Last Post: 04-03-2000, 01:08 AM
  5. Problem with CryptoAPI and JCE
    By Jason Bock in forum VB Classic
    Replies: 0
    Last Post: 03-21-2000, 07:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center