我正在使用iostream和map。当我尝试设置函数时,它们会抛出错误。
我的代码:
#include "string"
#include "iostream"
#include "map"
using namespace std;
class myClass {
map<string, string> Map;
Map["Ziv"] = "Sion";
cout << Map["Ziv"];
};
Run Code Online (Sandbox Code Playgroud)
我的错误:
error: 'Map' does not name a type
error: 'cout' does not name a type
Run Code Online (Sandbox Code Playgroud)
为什么我不能使用iostreamand cout?