//gua.cpp
#include "gua.h"
#include <iostream>
#include <string>
#include <map>
using namespace std;
const string guaming[] = {"乾","兑","离","震","巽","坎","艮","坤"};
const vector<string> yao[] = {{"阳","阳","阳"},{"阳","阳","阴"},{"阳","阴","阳"},{"阴","阴","阳"},{"阴","阳","阳"},{"阴","阳","阴"},{"阴","阴","阳"},{"阴","阴","阴"}};
const string wuxing[] = {"金","金","火","木","木","水","土","土"};
map<string, int> guaIndex; /*用于快速查找八卦名称的索引号*/
for (int i = 0; i < 8; i++) {
guaIndex[guaming[i]] = i;
}
/*以下代码省略*/
为什么在for语句那里提示"expected a declaration."错误?
希望高手能帮忙找出根本原因,是在看不出哪里有语法错误!
for 语句只能出现在函数里。