Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从标准输入中读取并通过十进制值将每个字符彼此区分开来。据我了解,换行(10)和回车(13)将被解释为同一个字符。我想区分这两者。我知道如果我正在从文件中读取,我可以使用 ios::binary 参数打开它。但是如果我从标准输入读取呢?
您可以使用 get 从 std::cin 中读取。此方法专为读取未格式化的数据而设计(请参阅 doc)