Here, cin>>id; the user types in the value for id and presses the enter key. The cin >> operator will first ignore any leading whitespace, then read the value of the id which is an integer. The input operation stops as soon as it reaches the end of the integer, and leaves the newline character '\n' sitting in the input buffer.
Next, the getline() operation will read everything up to the newline, which is read and discarded. The result is an empty string is read by getline.
In order to avoid this, you need to remove the newline from the input buffer. That's what the cin.ignore() does. Though as written, it ignores just one character. If the user had entered any spaces after typing the id, this would not be sufficient as there is more than one character to be ignored. You could use cin.ignore(1000, '\n') to ignore up to 1000 characters, or until the newline is reached.