C++ 的 getline 函数时遇到的问题

程序代码:

#include 
#include 
using std::cout;
using std::cin;
using std::endl;
using std::string;
class Human
{
public:
  void GetName()
  {
      cout<<"请输入名字:";
      std::getline(std::cin, thename);
  } 
  void GetStature()
     {
     cout<<"请输入身高(厘米):";
     cin>>stature;
     }
  void GetWeight()
     {
     cout<<"请输入体重(公斤):";
     cin>>weight;
     }
  void PrintStature(){cout<<"身高为:"<GetName();
     Xman->GetStature();
     Xman->GetWeight();
     Xman->PrintName();
     Xman->PrintStature();
     Xman->PrintWeight();
     cout<<"是否继续输入?(y/n)";
     cin>>GoOn;
     if(GoOn=='n'){break;}
}
     delete Xman;
     return 0;
}


你可能感兴趣的:(C++ 的 getline 函数时遇到的问题)