I am trying the following code:
int main()
{
char str1[20];
int a;
cout << "Enter Integer:"
cin >> a;
cout << "Integer:"<<a<<endl;
cout << "Enter string:"<<endl;
cin.getline(str1,20);
cout << "Input String is:"<<str1;
return 0;
}
and OUTPUT is:
Enter Integer:20
Integer:20
Enter string:
Input String is:
I am able to enter the string when not accepting integer using cin, but when I try to use cin.getline() after cin, its not working.
Can anybody help?