hi friends im facing one problem
i have used cin to input a choice like (cin>>ch)
then i have used to take input to string as getline(cin, string_s)
but getline does not works when i use cin

if i donot use cin it works well
why it is happening???
and is there any alternative to take integer then string input

Hi,
I think the issue you are facing is that the input stream needs cleared after a call to cin before getline. As far as i recall cin leaves the '\n' character on the stream so getline returns with nothing. See this post from narue on how to achieve this http://www.daniweb.com/software-development/cpp/threads/90228 Im not 100% sure this is the correct explanation but i do recall seeing and having this problem before and that was the solution.

Hope this solves your problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.