sir why we have to write using namespace std in every program of c++. i know cin and cout are the objects of istream and ostream so if we include iostream that contains cin and cout but it shows me error so actually what is inside of using namespace std.
Why using namespace std;
hello @firsttry786new
first of all u need to understand what is namespace.
in c++ giving a name to some set of instruction / space or block is called namespace.this is done to resolve scope , same variable name conflict.
when we write # include < iostream > then linker links all the libraries that are divided in various namespaces to our code.
cin and cout objects are delcared within std namespace.
so to use them(cout,cin) first we need to mention name of namespace then scope resolution operator and then object name.
like
std::cout (std is name of namespace where cin/cout is present and cout is object name)
now if u dont want to use these long statements simply add using namespace std;
in ur code . when compiler see this line then it will understand that we are talking about std namespace