我在CodeBlocks中使用的头文件包含常量,例如“ const string a =“ A”;“和“ const string bm =“ B-”;“。我正在尝试使用下面的映射将这些常量映射到其他值,但是当我返回map [对常量的引用]时,它不会输出任何内容。发生了什么事?
map<string, double> convGPA;
convGPA[a] = 4.0;
convGPA[am] = 3.7;
convGPA[bp] = 3.3;
convGPA[b] = 3.0;
convGPA[bm] = 2.7;
convGPA[cp] = 2.3;
convGPA[c] = 2.0;
convGPA[cm] = 1.7;
convGPA[dp] = 1.3;
convGPA[d] = 1.0;
convGPA[dm] = 0.7;
convGPA[f] = 0.0;