devc++ help

can someone please tell me the main difference in turbo & dev C++.

I can program in Turbo C++ but don’t know a thing about dev. So can I ask u a favour to teach me what all i should know to program in dev c++.
Please teach me what all is new.

1 Like
  1. Turbo C++ is a 16 bit compiler, so the sizeof(int) is 2 bytes but dev c++ is 32 bit, so the sizeof(int) is 4 bytes. This is the major advantage.
  2. You can not declare very large arrays(size=106to 107) in turbo but you can do this in dev c++ by declaring the array as global. This is because turbo can not allocate this much memory to the program.
  3. The C++ header files have a .h( example < iostream.h > ) in turbo but this is not supported in dev c++.
    In dev, the standard C files like stdio are can be used with .h and the C++ header files are to be used without .h

Example: #include< iostream> (not < iostream.h >)

  1. There was an introduction of namespaces in C++ standards, a namespace is a named blocked used for declaring objects or variables. cin cout and all other entities are inside a namespace std.

    So, you need this line using namespace std; after including the header files into the program.

    If not used then, you need to place std:: in front of all the objects.

    For Example:
    std::cin>>a;
    instead of cin>>a;
    (So, write using namespace std; after the header files have been included.)

  2. The most important reason: STL(standard template library) is not there in Turbo. So, you cannot use headers like
    < vector>< map> < algorithm> and many more such headers.

The thing is that turbo is an old compiler, and the compilers here at codechef or any other programming site will compile according to the current standard.

So, you have to code according to the current C++ standards.

Codechef uses GCC compilers.

Start using dev C++, it is a good compiler.


Here, is the sample code in dev:


#include< iostream > //See no .h

#include< cstdio>
using namespace std; //As namespaces were introduced in C++ after turbo

int main()

{

int a;// the size of int will be 4 bytes in DEV C++ as it is 32 bit compiler

cin>>a;//rest is the same as turbo.

cout<< a;

return 0;

}



// All standard C files like string.h,etc are used by dropping the .h and placing a c before the name, like < string.h> will be < cstring> but .h will also work. So, <string.h > will also work fine.

3 Likes

First thing first, Turbo C++ and Dev C++ are not compilers, they are IDE(Integrated Development Environment)…

The difference between them is that the Dev C++ uses MinGW compiler while Turbo C++ use Turbo C++ compiler(Borland’s compiler).
The main similarity being DevC++ and Turbo C++ are both outdated.

I would suggest you to use codeblocks or the updated version of DevC++ made by Orwell(http://sourceforge.net/projects/orwelldevcpp/) which is much better than the original devC++ though there are some problems with it.

Using DevC++:
Make sure you are using standard headers. Do not use conio.h ; this is not part of the C standard library. Do not use iostream.h; this is a deprecated header file and again is not a standard library. (You should just be using iostream instead).

Other than this you should read STL tutorials from topcoder:

http://community.topcoder.com/tc?module=Static&d1=features&d2=082803
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=standardTemplateLibrary

Also make sure you read the code written by other people(You can find the AC solutions in ‘Other Submission’ Button in any problem page).

If you want help…then comment your prob…i will be happy to help.

2 Likes

I tried out procon junior and was able to make most of problems in turbo but couldn’t do a thing when it came to dev and couldn’t submit even a single correct answer.

Please help me.

1 Like