New course! Every coder should learn Generative AI!
Try a free lesson+ 4
I think you want std::getline()
And maybe see std::cin.ignore()
http://www.cplusplus.com/reference/string/string/getline/
http://www.cplusplus.com/reference/istream/istream/ignore/
https://www.google.com/amp/s/www.geeksforgeeks.org/clearing-the-input-buffer-in-cc/amp/