I'm trying to write code that can get input from a user. The input will be something like "1 empty container" or "5 fish", etc. Basically a number followed by one or more strings. Here is my code:
The problem I'm having is that itemname seems to only pick up the first string. Is there a way to set it equal to the entire string, possibly including spaces?
The >> operator for std::cin is delimited by whitespace, meaning it will parse your number until a space, then try to parse itemname until a space, and then not actually parse your third item.
If you want to get user input with spaces, you must use std::getline