char str[] = "123";
    // strlen 只计算可见字符, sizeof 则包含'\0' 在内
    cout << "strlen : " << strlen(str) << endl;
    cout << "sizeof :" << sizeof(str) << endl;
    char name[10];
    char name1[10];
    //get 另一种变体即使流中有换行符也可以读取下一行
    //在输入输出流中 换行显得尤为重要,以及怎么样合理的去处理
    cin.get(name, 10).get();
    cout << name << endl;

    cin.get(name1, 10);
    cout << name1 << endl;

 

相关文章:

  • 2021-11-29
  • 2021-12-16
  • 2021-11-10
  • 2021-06-05
  • 2022-03-08
  • 2021-06-27
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2021-08-26
  • 2022-02-07
  • 2022-01-23
相关资源
相似解决方案