How to make cin work after using getline?
问题 So, I read a string using cin.getline(str,10,'h') where as you can see I have used a custom delimiter 'h' and want to read a maximum of 9 characters. After doing this, I use cin>>n to read an integer into my int variable n. #include <iostream> using namespace std; int main() { int n; char str[100]; cin.getline(str, 10, 'h'); cout<<str<<'-'<<endl; cout<<"Enter a number:"; cin>>n; cout<<n; return 0; } Suppose I pass the following input 2 3 pl32 which is a '\n' followed by "2 3 pl32". I expect