zhang-zsq

string 类读入空格

#include <iostream>
using namespace std;

int main()
{
    string str;
    getline(cin,str);能读入空格
    cout<<str;
    return 0;
}
#include <iostream>
using namespace std;

int main()
{
    string str;
    cin>>str;// 不能读入空格
    cout<<str;
    return 0;
}

 

分类:

技术点:

相关文章:

  • 2021-09-19
  • 2021-09-19
  • 2021-09-19
  • 2021-11-05
  • 2021-03-06
  • 2021-12-15
  • 2021-09-19
  • 2021-11-05
猜你喜欢
  • 2021-05-27
  • 2021-09-19
  • 2021-10-28
  • 2021-09-19
  • 2021-09-19
  • 2021-11-20
相关资源
相似解决方案