Please help me in this code!
Simultanious getline (cin, string) not working. I want a string, a integer and again a string as input ( in same sequence) as separate inputs i. e. on different lines. But second getline function is not showing output(probably not accepting input). But if you change sequence, i.e. use two getline next to each other it works fine. Please guide me what should I do and why this is happening? #include <iostream> #include <string> #include <cstring> using namespace std; int main() { string myName, otherName; int num; getline(cin, myName); cin >> num; getline(cin, otherName); cout << myName << "\n" << num << "\n"<< otherName; return 0; } Sample Input: ABC 5 XYZ Expected output: ABC 5 XYZ Actual Output: ABC 5 https://code.sololearn.com/c7R9gt4k6SpY/?ref=app