AdvanceY
AdvanceY
2021-01-17 20:57

请问,如下的C++中代码是咋回事?为何这样子一来就可以完整的显示变量名为ch的字符串。

  • c++
#include <iostream>

int main()
{
    using namespace std;
    char ch;
    int count = 0;
    cout << "Enter characters; enter # to-quit:\n";
    cin >> ch;
    while (ch != '#')
    {
        cout << ch;
        ++count;
        cin >> ch;
    }
    cout << endl << count << " characters read\n";
    return 0;
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答