【发布时间】:2015-06-07 17:19:23
【问题描述】:
所以基本上我想找出什么,以这种情况为例:
std::string input;
Ask user for a string?: Apples
cin >> input;
std::string Apples = "input";
所以基本上,我向用户询问一个字符串,然后创建一个具有该字符串名称的变量。这可能吗?
【问题讨论】:
标签: c++
所以基本上我想找出什么,以这种情况为例:
std::string input;
Ask user for a string?: Apples
cin >> input;
std::string Apples = "input";
所以基本上,我向用户询问一个字符串,然后创建一个具有该字符串名称的变量。这可能吗?
【问题讨论】:
标签: c++
不,你不能那样做。
最接近的功能是使用地图。
std::map<std::string, int> aMap;
【讨论】: