Hi, I am trying to learn OOP with c++ with the help of Turbo C++ version 3.0 and "C++ Primer Plus" by stephen prata.

according to the book, the NEW convention for including the iostream header file in c++ is in the following way:
#include<iostream>
but it causes an error saying : unable to open include file "IOSTREAM"

however the following code works:
#include<iostream.h> but it is supposed to be the OLD convention

Moreover , according to the book, it is necessary to use the following:
using namespace std
so that we can use cout and cin directly without having to tytpe std::cout or std::cin

but when I use this an error saying "declaration syntax error" appears

the weird thing is that cout and cin work just fine without this statement when they are not supposed to do so

This is really confusing as I dont know which is right and which is wrong, could use some help

Also I would appreciate it if anyone could suggest a better IDE for windows 7 32 bit

Edited 4 Years Ago by clarkkent021

This is really confusing as I dont know which is right and which is wrong, could use some help

They're both right. Your compiler is right because it's from 1991 and conformed to the C++ of the time. Your book is also right because it's reasonably current with the ISO C++ standard that was first introduced in 1998 and heavily updated in 2011.

If you want to learn C++ as it was two decades ago then get a book that was printed two decades ago. On the other hand, if you want to learn C++ in a way that would be useful in this millennium then dump your compiler and get a newer one.

Also I would appreciate it if anyone could suggest a better IDE for windows 7 32 bit

Everything is better. :D Try Visual C++, Code::Blocks, and CodeLite. The former uses Microsoft's compiler and the latter two use MinGW and GCC.

Edited 4 Years Ago by deceptikon

@ decepticon
Thanks for the help, appreciate it

Edited 4 Years Ago by clarkkent021

hi, I installed both codeblocks ans codelite as suggested but these two IDEs are much different from the simple turbo c and I am having some similar problems using the two.:-

during the first session i created a workspace and a new project(a console application)
a main.c was created by default with the new project and it runs fine with the sample code to print "hello world".
But the problem is that when I create a new source code and try to run it after compiling it, whatever the code is I get only "hello world" as the output.
I tried deleting the default main.c but it gets created everytime I compile any other source code.
I would really appreciate it if anyone could just tell me where the problem is.

This article has been dead for over six months. Start a new discussion instead.