Getline keeps on getting newline character. How can I avoid this?
ignore() function does the trick. By default, it discards all the input suquences till new line character. Other dilimiters and char limit can be specified as well. http://www.cplusplus.com/reference/istream/istream/ignore/ In your case it goes like this. cin >> N; cin.ignore();