Thread: DEV-C++ compiler message/

  1. #1
    Registered User tu_user's Avatar
    Join Date
    Jan 2004
    Posts
    36

    Question DEV-C++ compiler message/

    I made my program to reverse digits of a four digit integer value entered by the user. Here is the code:

    Code:
    #include<iostream>
    #include<conio.h>
    
    using std::cout;
    using std::cin;
    using std::endl;
    
    void reverse(int)   // function prototype
    
    int main()
    {
        int num;    // declare varible
        cout<< "Enter any 4 digit integer:";    // prompt the user for input
        cin>> num;    // read input
        reverse(num);    // display reverse order
        
    getch();
    }
    
    void reverse(int value)    // definition    
    {
        int digit1, digit2, digit3, digit4; // declare alias
        digit1=value%10;    // separate digit1
        value/=10;    // divide the remaining 3 digit number
        digit2=value%10;    // separate digit2
        value/=10;    // divide the remaining 2 digit number
        digit3=value%10;    // separate digit3
        value/=10;    // separate the last remaining digit
        digit4=value%10;    // separate digit4
        cout<< digit4 << digit3 << digit2 << digit1;    // reverse order
    }
    I think the code is okeys but the compiler gives me the following message when i press F9.

    'unable to run the program'

    Is there anything wrong with the compiler? Do I have to reinstall it?

  2. #2
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    are you running the beta version of Dev. Because I tried to write like 3 different programs and it gave me the same message..so I just saved myself the heart ache and just switched back to
    Dev-C++ 4

    that should do it.
    Which 'a Huh?

  3. #3
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    It happened the same thing with me. To fix it, at least it worked for my case, go to Tools->Compiler Options->Directories tab and you'll have four tabs (Binaries, Libraries, C includes, C++ includes). In my case I just have to fix the directory paths to where I installed Dev. It was previously set to wrong directories, so when I compiled, it couldn't find all those includes'. Okay, so try fixing everything under those four tabs.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  4. #4
    Registered User tu_user's Avatar
    Join Date
    Jan 2004
    Posts
    36
    it version 4.9.8.0

    its beta i think

    if so should i reinstall it or download the other version

  5. #5
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Originally posted by tu_user
    it version 4.9.8.0

    its beta i think

    if so should i reinstall it or download the other version
    Did you try (or even read) my possible solution? No..?
    'Cause that's what I did (reinstalling) the first time but it did not fix it.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  6. #6
    Registered User tu_user's Avatar
    Join Date
    Jan 2004
    Posts
    36
    directories are fine.

  7. #7
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    'unable to run the program'
    Google with that keywords. That's how I found the solution for me. You could probably find a solution for yours. So many, many people have the same problem.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  8. #8
    Registered User
    Join Date
    Nov 2003
    Posts
    66
    Okay, first of all, there's a few problems with your code:

    1. prototypes should have ';' at the end
    2. it's cout << 1 << 2 << 3 << 4 not cout << 4 << 3 << 2 << 1

    The code works perfectly fine on my Dev C++4.9.8.0, so i dunno wat's wrong with yours, but here's the code:


    Code:
    #include<iostream>
    #include<conio.h>
    
    using std::cout;
    using std::cin;
    using std::endl;
    
    void reverse(int);   // function prototype
    
    int main()
    {
        int num;    // declare varible
        cout<< "Enter any 4 digit integer:";    // prompt the user for input
        cin>> num;    // read input
        reverse(num);    // display reverse order
        
    getch();
    }
    
    void reverse(int value)    // definition    
    {
        int digit1, digit2, digit3, digit4; // declare alias
        digit1=value%10;    // separate digit1
        value/=10;    // divide the remaining 3 digit number
        digit2=value%10;    // separate digit2
        value/=10;    // divide the remaining 2 digit number
        digit3=value%10;    // separate digit3
        value/=10;    // separate the last remaining digit
        digit4=value%10;    // separate digit4
        cout<< digit1 << digit2 << digit3 << digit4;    // reverse order
    }
    An Unofficial Cristiano Ronaldo Website : Ronaldo 7

  9. #9
    Registered User tu_user's Avatar
    Join Date
    Jan 2004
    Posts
    36
    yeah thankx. The code is okeys. The prob was with my compiler. I downloaded version4. its not bets. The one i was usin was beta so it stuck. Well thanku v m for ur help.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Actually, the current Dev-C++ 4.9.8.5 "beta" should be better and more stable than Dev-C++ 4, according to some Dev-C++ veterans on their sourceforge forum.

    There probably was some other problem with your Dev-C++ installation.

  11. #11
    Registered User tu_user's Avatar
    Join Date
    Jan 2004
    Posts
    36
    yeah i think so. Version 4.9.8.0 is great.

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Well, read this article.

    That's also why it is usually good to post your full compile log.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Making a script language?
    By Blackroot in forum Game Programming
    Replies: 10
    Last Post: 02-16-2006, 02:22 AM
  4. OpenScript2.0 Compiler
    By jverkoey in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2003, 01:52 PM