0

<iostream>

if iostream has strings as well in it then in arrays why are we using cstring as header

13th Apr 2017, 3:50 PM
Mubarak Hussain
Mubarak Hussain - avatar
3 Respuestas
+ 1
Do not use cstring use string instead. It is a c++ class that runs just as fast as cstr functions. The string class offers things like .length() method and several other useful methods such as concatenation and comparison. #include <iostream> #include <string> using namespace std; int main() { string name = "Mark"; cout << name << " number of characters : " << name.length() << endl; return 0; };
13th Apr 2017, 5:11 PM
Joshua Pierson
Joshua Pierson - avatar
+ 1
It doesn't matter much if you put a header twice in different files. They all have a protection for redefinition, so they are loaded only once. It is aways good to put it there so you don't get problems if you want to remove <iostream> to use another channel for input or output.
13th Apr 2017, 6:25 PM
Denis Felipe
Denis Felipe - avatar
+ 1
great!
15th Apr 2017, 5:49 PM
Mubarak Hussain
Mubarak Hussain - avatar