I was trying to traverse a std::wstring
, here's my code:
#include <iostream>
int main() {
std::wstring ws;
std::getline(std::wcin, ws);
for (auto wc : ws) {
std::wcout << wc << std::endl;
}
}
When I tried to run this program, typed “你好” into the console, the program just printed 4 blank lines.
What I expect the program to output:
你
好
I have searched this site and came back with no solution.
What should I do to produce the result I expect?