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.
我想做一个数组,无论用户输入什么,每个单独的字母和数字都会被放入数组中。例如:
键盘输入:Hakuna Matata
你会得到一个如下所示的数组:
{'H','a','k','u','n','a',' ',' 'M','a','t','a','t','a', ...}
我将如何进行编码?
那将通过一个字符串:
std::string s; std::cin >> s; std::copy(s.begin(), s.end(), std::ostream_iterator<char>(std::cout, " ");
输出:
哈库纳