Thread: DEV C++ help

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    2

    DEV C++ help

    Ok i just got the Dev C++ compiler and when i execute my program is starts to bring up a ms-dos like window and then it disappears before i can even read anything. Im not sure if this isa problem with my compiler or if its a setting on my computer thats making this happen. If somebody could please tell me whats wrong i would really appreaciate it.

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    At the end of your code, but before: return 0;
    Add this: cin.get();
    Code:
    #include <iostream>
    using namespace std;
    
    int main(void)
    {
    .
    .
       cin.get();
       return 0;
    }
    Or read the programming faq for more ways: http://faq.cprogramming.com/

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    2
    Thank you very much!

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    17
    Hey i have the same compiler
    the solution mentioned before may work, but i think that my solusion is the preferred one. I had the same problem, but i saw it published in a book when i was at barnes-and-nobles that you should enter a line of code that looks like this:
    Code:
    system ("PAUSE")
    at the end of your program just before return 0. so a code would look like this
    Code:
    #include <iostream.h> 
    int main 
    { 
    */ write some code */ 
    system ("PAUSE"); 
    return 0;
    }

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    56
    If you use

    Code:
    system ("PAUSE");
    Make sure to include
    Code:
    #include <stdlib.h>
    With the Dev C++ compiler when you open new source files it has them already included.

  6. #6
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I believe <cstdlib> will work as well, but remember system() is OS dependent
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    17
    I agree with what you both said, and for the guy who started the post, using: system("PAUSE") is prolly the solusion you will find the best.

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    Originally posted by JaWiB
    I believe <cstdlib> will work as well, but remember system() is OS dependent
    yeah, it will, and should actually be used to follow standard. you'll probably get backwards warnings with stdlib.h. you should also be able to include <windows.h>.

  9. #9
    Registered User
    Join Date
    Aug 2003
    Posts
    7
    system("PAUSE");

  10. #10
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Originally posted by alpha
    yeah, it will, and should actually be used to follow standard. you'll probably get backwards warnings with stdlib.h. you should also be able to include <windows.h>.
    nope, no backwards warning... at least not with dev V 4.9.8.0
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 1
    Last Post: 03-08-2004, 05:19 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM