I\'m sorry but I\'m quite new to C++ but not programming in general. So I tried to make a simple encryption/decryption. However when I added the modification to my previous code
As other stated already, the formatted input (using in >> value
) start skipping space abd stop when they are done. Typically this results in leaving some whitespace around. When switching between formatted and unformatted input you typically want to get rid of leading space. Doing so can easily be done using the std::ws
manipulator:
if (std::getline(std::cin >> std::ws, line)) {
...
}