std::getline input not working properly in C++ [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Need help with getline() getline not asking for input? I am working on the following code: int main() { int num; string str; cin>>num; int points[num][2]; for(int i=0;i<num;i++) { cout<<"\nPoint"<<i<<":"; getline (cin,str); points[i][0]=atoi(&str[0]); points[i][1]=atoi(&str[2]); } for(int i=0;i<num;i++) { cout<<"\npoint"<<i<<" = "<<points[i][0]<<" "<<points[i][1]; } The problem with the above code that I am