0

Why we add #include<iostram>?i mean what is it and what is the purpose?

4th Nov 2016, 5:42 PM
Bunnu
Bunnu - avatar
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
4th Nov 2016, 5:55 PM
TheLastCookie
TheLastCookie - avatar
+ 1
namespace is not a library. With namespace we can use functions, variables, classes and so on with the same name.
4th Nov 2016, 6:03 PM
TheLastCookie
TheLastCookie - avatar
0
and why we use two libraries?iostream and namespace?
4th Nov 2016, 5:57 PM
Bunnu
Bunnu - avatar
0
thanks.that was really helpful
4th Nov 2016, 6:08 PM
Bunnu
Bunnu - avatar
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
4th Nov 2016, 6:49 PM
Taras Bilobran
Taras Bilobran - avatar
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"
4th Nov 2016, 9:07 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar