0
<iostream>
if iostream has strings as well in it then in arrays why are we using cstring as header
3 Respostas
+ 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;
};
+ 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.
+ 1
great!