getline无法正确读取字符串

时间:2018-06-21 09:19:25

标签: c++ input

我已经编写了这段代码来输入数字和一行,但是getline只读取'enter'字符。

#include<iostream>
using namespace std;

int main()
{  
    int t;
    cin>>t;
    string s;
    getline(cin,s);
    cout<<s<<endl;
 }

0 个答案:

没有答案
相关问题