I hope, this is not a compiler issue. See the below code
#include <iostream>
#include <string>
using namespace std;
string data,name;
void getTst()
{
cout<<"Enter Name :";
getline(cin,name);
cout<<"\nENter data :";
getline(cin,data);
}
void dispTst()
{
cout<<"\nName :"<<name;
cout<<"\n Data :"<<data;
}
int main()
{
int tmp;
cin>>tmp;
getTst();
dispTst();
}
in this code, before calling getTst() function I'm reading the value for tmp.In runtime, I gave the input to "tmp" and pressed ENTER. so ascii value of ENTER is stored in the "name" variable and cursor is waiting to get input for "data".