I am trying to solve a problem , in that i have to take a string input until enter is pressed and then a integer . I am using this code but its taking integer value as 0 everytime
int n;
char s[500];
gets(s);
cin>>n;
cout<<s<<" "<<n<<endl;
input : Hello world
14
output : Hello world 0
Actually i am not even able to give the integer input , it take itself as 0 .