When cin>>(int) and cin>>(string) are called, when the first input is not correct for integer, it seems that cin>>(string) will fail to retrieve the second input even if it is correct string.
The source code is simple as:
cout<<"Please enter count and name"<<endl;;
int count;
cin>>count; // >> reads an integer into count
string name;
cin>>name; // >> reades a string into name
cout<<"count: "<<count<<endl;
cout<<"name: "<<name<<endl;
The test cases are:
Case 1: Type characters(which not fit for int) and characters
Please enter count and name
ad st
count: 0
name:
Case 2: Type numbers and characters
Please enter count and name
30 ad
count: 30
name: ad
Case 3: Type numbers and numbers (which could be taken as strings)
Please enter count and name
20 33
count: 20
name: 33