0
Why we add #include<iostram>?i mean what is it and what is the purpose?
6 Réponses
+ 1
iostream is a library and if we include a library to code we can use it. As example:
#include <string>
Now we can declare a variable as string.
string a;
string = "Hello";
cout << a;
//Outputs Hello
+ 1
namespace is not a library. With namespace we can use functions, variables, classes and so on with the same name.
0
and why we use two libraries?iostream and namespace?
0
thanks.that was really helpful
0
iostream allow you to take informtion from user and show some info to user but don`t give a function for this and namespace std is providing such function like"cout" and "cin" that allow you to use i/o stream without understending how it works you just using function that was writen before you
0
In C++, the built in C++ library routines are kept in the standard namespace. That includes stuff like cout, cin, string, vector, map, etc and so they left it as using namespace std; which is shorter than typing all while without using namespace std; you would have to put std:: before a lot of stuff e.g: std::cout << "this is exhausting"