#include "stdafx.h" #include #include using namespace std; int main(int argc,argv[]) {string a="abcd"; string b; b=a.substr(0,1); switch (b) { case "a": cout<<"a!"; break; case "b": cout<<"b!"; break; } } 编译结果指着switch (b)这行出错,说switch expreation type of "std::string"