-5
我在C++初学者,我的编译器(C-免费5.0)无法编译此代码: -将代码从C++ 11转换为C++ 98?
#include <iostream>
#include <map>
#include <string>
int main()
{
std::string input = "slowly";
std::map<char, int> occurrences;
for (char character : input)
{
occurrences[character] += 1;
}
for (auto& entry : occurrences)
{
std::cout << entry.first << '=' << entry.second << std::endl;
}
}
谁能告诉我如何让它在我的编译器工作?
使用'的std :: string ::迭代'和'std :: map :: iterator' –
搜索如何遍历字符串和地图。 – juanchopanza
你能写出完整的代码作为回答请 – Dreamer