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 :";
    cout<<"\nENter data :";
void dispTst()
cout<<"\nName :"<<name;
    cout<<"\n Data :"<<data;
int main()
    int tmp;


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".

You are mixing input types. After your call to cin >> tmp you need to clear the input buffer. You can use cin.ignore() for this. If that does not work narue has a good sticky thread on how to clear the input buffer that is very informative