map

转胡艳梅的问题,改了一下代码

#include <map>
using namespace std;

map<char,int> m;
m;
    int main()

     {
    m['C'] = 1;
    m['G'] = 2;
    m['T'] = 3;
    m['-'] = 4;

     }
编译错:
huym.cpp:6: error: expected constructor, destructor, or type conversion before ';' token
-----------
说明m作为全局变量,但在编译期间不能引用;在main函数中就是运行时引用了。
原因不明。

杨贵福

One thought on “map”

Leave a Reply

Your email address will not be published. Required fields are marked *