4
Contributors
4
Replies
20
Views
4 Years
Discussion Span
Last Post by Ancient Dragon
0

Which to use will depend on your compiler. Old Turbo C++ will use iostream.h but all recent compilers use <iostream> (without the .h extension)

You also need a using statement.

#include <iostream>
using std::cout;
using std::cin;
0

simple, in order to avoid using

using std::cout and using std::cin
you can do the following:

  1. #include<iostream>
  2. using namespace std;
  3. cout<<""; cin>>a;

the second line sends a message to the compiler you will also use a name space called standard wich is a place where cin and cout are located.

that way you don't have to call the namespace (std::) everytime you need to use cout or cin

0

using namespace std; is actually bad practice because it floods the program with everything in std namespace, and sometimes that causes name clashes with your own code. I cam across that very situation in another thread here at DaniWeb just today. Even Bjarne Stroustrup, the author of c++ language, adises against using namespace std; statement.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.