Start here · Essential guide
How to Read String Input in C++
Learn how to read string input in C++ with std::cin and std::getline, handle leftover newlines, check stream state, and avoid unsafe gets() calls.
Strings, Containers and Memory
How to read text input in C++ and related functions like strstr.
Start here · Essential guide
Learn how to read string input in C++ with std::cin and std::getline, handle leftover newlines, check stream state, and avoid unsafe gets() calls.
In Python 3, input() always returns a str, even when the user types digits. Learn how to convert the result to a number and why that step matters.
strstr() searches a C string for a substring and returns a pointer to the first match, or NULL if nothing matches. Here is how to use it safely.
Related topics