I have the following piece of code in which the cin is before getline and the getline is capturing the new line hence not assigning any value to its variable; The code is
int main(){
string a,b;
int n;
cin>>n;
getline(cin,a);
cout<<a;
return 0;
}
PS:As soon as I press enter after entering a No , Program ends(i..e getline captures newline and so a is null.It would be great if someone could suggest me a resource for learning basic I/O Concepts in Cpp)