When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
9 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
template<
class CharT,
class Traits,
class Allocator>
std::basic_istream<CharT, Traits>& getline(
std::basic_istream<CharT, Traits>& input,
std::basic_string<CharT, Traits, Allocator>&
str,
CharT delim);
// ... and 3 more
Also, I’m contractually obligated to reproach you for using using namespace std;
using namespace std will import all of the symbols from std into the enclosing namespace. This can easily lead to name collisions, as the standard library is filled with common names: get, count, map, array, etc.
A key concern with using namespace std; is not what is imported now but rather what may suddenly be imported in the future.
While using namespace std; is alright for tiny projects, it is important to move away from it as soon as possible. Consider less intrusive options, if you insist on not using scope resolution:
// OK: *only* import std::vector
using std::vector;
// OK: namespace alias
namespace chr = std::chrono;
chr::duration x; ```
Why is "using namespace std;" considered bad practice?cin >> myString only reads a single word, getline(cin, myString) will read a whole line
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
❤️