Dlaczego muszę napisać „std :: string”, ale nie „std :: getline ()”?
Rozważ ten fragment kodu:
#include <iostream>
#include <string>
int main()
{
std::string str;
std::cout << "Enter a string: \n";
getline(std::cin, str);
}
Dlaczego muszę używaćstd::
dlastring
, cin
icout
, ale niegetline()
? Jestgetline()
nie w standardowej bibliotece? Właściwie jestem trochę zdezorientowany, dlaczego nie mogę po prostu pisaćusing namespace std;
i nie musi#include
wszystko w standardowej bibliotece. Z góry dziękuję!