Thread: Problem running prog I wrote in Dev C++

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    46

    Problem running prog I wrote in Dev C++

    When I finish coding my source file and compile it and no problem with that...when I choose run it open the Dos windows and closes in a fraction of a second as if it flashes once...how can i fix this prob?

  2. #2

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    46
    Ok it worked but some similar problem got in the way after i enter the number that the program requires the window closes....exactly after i press enter

    Code:
    #include<stdio.h>
    int main()
    {
        int number;
         printf("enter the number\n", number);
         scanf("%d", &number);
         number=number+1;
         printf("the new number is %d", number);
         return 0;
    }

  4. #4
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Obviously, the window is going to shut as soon as the program finishes, read the FAQ that Tonto posted carefully.

  5. #5
    Registered User
    Join Date
    Sep 2005
    Posts
    46
    when i try running the prog from CMD it opens dev.

  6. #6
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    Ok im shouting now. READ ON THE LINK ABOVE !!

    This is a very simple problem just read on the link tonto gave to you.

    peace

  7. #7
    Registered User
    Join Date
    Sep 2005
    Posts
    46
    i did man and still after i enter the number and press enter it shutsdown and when i open from CMD from the beginning of all it opens dev.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > when i open from CMD from the beginning of all it opens dev.
    Try running the executable program (prog.exe), not the source code (prog.cpp)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User
    Join Date
    Sep 2005
    Posts
    46
    it worked finally...thanks guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker Problem with Dev C++
    By Brownie in forum C++ Programming
    Replies: 2
    Last Post: 09-26-2008, 07:18 AM
  2. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  3. Problem running a Cboard C++ tutorial!
    By Monkey Liar in forum C++ Programming
    Replies: 6
    Last Post: 02-15-2002, 03:32 AM
  4. problem with prog
    By katal in forum C Programming
    Replies: 5
    Last Post: 01-10-2002, 09:16 PM
  5. prog problem
    By katal in forum C Programming
    Replies: 5
    Last Post: 01-10-2002, 06:13 PM