can you help me Why this code can't be swap
cout << "Enter a string: ";
getline(cin, str1);
cout << "Enter another string: ";
cin.get(str, 100, '\n');
Into
cout << "Enter string: ";
cin.get(str, 100, '\n');
cout << "Enter a string: ";
getline(cin, str1);
when i ran First code Output :
Enter a string: hai
Enter another string: hello
Second code Output :
Enter another string: hello
Enter a string:
I can't input anymore, it just directly returned 0
Is it because of delimiters?