Problem of getline(cin, <string_name>) in class

Hi everyone, nice to meet you~ I will be very grateful if you help me.
these are my following code in my class with the name of song. No syntax error, but when i run it, it will skip the name part and straight to the genre part.
May I know where did i type wrong? @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  class song 
{
	int index=001;
	string song_name;
	string song_genre;
	string song_singer;
	
	public:
		void add_song()
		{
			cout << "Adding new song mode"<<endl;
			cout << "Current song index="<< index<<endl;
			cout << "Please enter song name:";
			getline(cin,song_name);
			cout << "Please enter the song genre:";
			getline(cin,song_genre);
			cout << "Please enter the song's singer:";
			getline(cin,song_singer);
			index++;
		}
};
closed account (E0p9LyTq)
C++: Console User Input Done Right
http://www.lb-stuff.com/user-input
Topic archived. No new replies allowed.