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

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.

@ decepticon
Thanks for the help, appreciate it

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.

#include <iostream.h> 
#include <conio.h>
struct tree {     int d;
tree *left, *right; };
void insert(tree*, tree*);
void print(tree*);
void main() { 
clrscr();     int i;
int  a[15] = { 25,20,7,13,33,50,45,17,30,55 }; 
tree *node, *s, *p, *root = NULL;
for (i = 0; i < 10; i++) {  
node = new tree;  
node->d = a[i];     
node->left = node->right = NULL;  
if (root == NULL)        
root = node;    
else           
insert(root, node); 
}     print(root);  
getch();} 
void insert(tree* root, tree* node)
{     tree *p, *s;  
 s = root; 
 while (s != NULL) 
 {         p = s;  
 if (node->d > s->d)  
 s = s->right;       
 else           
 s = s->left;     }  
 if (node->d > p->d)   
 p->right = node;    
 else     
 p->left = node; }
 void print(tree* node) { 
 if (node != NULL) { 

        print(node->left); 
        cout << node->d << " ";
        print(node->right);     } }  

Hi Ebrahim

Welcome to DaniWeb.

your questions and contributions are very welcome here, but please be aware of the rules and best practices for this site, including:

don't hijack someone else's topic for your question. Start you own topic.

if you have a question, ask it! Simply posting code does not tell us what help you need

So please start your own topic, explain what help you need, and finally format/indent your code properly so people can read it easily.

#include<iostream.h>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.