Thus when you try and read the name with getline(cin,name) it reads to the end of line. BUT NOTE ...
stackoverflow.com