Thread: Programming With Dev C++

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    7

    Programming With Dev C++

    Hi
    Im working with dev c++ and until now Ive been writing programs in C, and compiling them without any problems in DevCPP

    the problem is that when i write code in C++ , Dev C++ wont compile it.

    I copy pasted a code from some C++ book and tried to compile it ,
    heres the code and the the errors given by cpp:

    code:
    Code:
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    using namespace std;
    int main(int nNumberofArgs, char* pszArgs[])
    {
    
    int celsius;
    cout <<“Enter the temperature in Celsius:”;
    cin >> celsius;
    
    int factor;
    factor = 212 - 32;
    
    int fahrenheit;
    fahrenheit = factor * celsius/100 + 32;
    
    cout << “Fahrenheit value is:”;
    cout << fahrenheit << endl;
    
    system(“PAUSE”);
    return 0;
    }

    errors:
    Code:
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp: In function `int main(int, char**)':
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:14: error: stray '\147' in program
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:14: error: `Enter' undeclared (first use this function)
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:14: error: (Each undeclared identifier is reported only once for each function it appears in.)
    
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:14: error: expected `;' before "the"
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:14: error: stray '\148' in program
    
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:25: error: stray '\147' in program
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:25: error: `Fahrenheit' undeclared (first use this function)
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:25: error: expected `;' before "value"
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:25: error: stray '\148' in program
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:29: error: stray '\147' in program
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:29: error: stray '\148' in program
    C:\Documents and Settings\Owner\שולחן העבודה\5.cpp:29: error: `PAUSE' undeclared (first use this function)
    
    Execution terminated
    whats wrong ??
    is there some configuration i have to do before coding in c++??

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    I think your quotes characters have the wrong ASCII value. I'm taking a shot in the dark here, that you don't have a standard US/UK keyboard? Or you copied the source from a Word or something. Try replacing the quotes with standard "" quotes and I bet it will compile just fine.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    7

    Cool

    THANKS MAN!
    it was that !

  4. #4
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by v01d View Post
    THANKS MAN!
    Anytime
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM