error in getline input in c++ [duplicate]
问题 This question already has answers here : Why does std::getline() skip input after a formatted extraction? (3 answers) Closed 5 years ago . Hi guys i am facing an unknown error while taking input from getline.My purpose is to take a number and two strings as input from the user and print the first string.Here is the problem code #include <iostream> using namespace std; int main() { int t; cin>>t; while(t--) { string s,p; getline(cin,s); getline(cin,p); cout<<s; } return 0; } Now when i give