是否可以将变量声明为字符串?

时间:2015-06-07 17:19:23

标签: c++

所以基本上我想要找到的,采取这种情况:

std::string input;
Ask user for a string?: Apples
cin >> input;
std::string Apples = "input";

基本上,我向用户询问一个字符串,然后创建一个名称为该字符串的变量。这可能吗?

1 个答案:

答案 0 :(得分:1)

不,你不能这样做。

最近的功能是使用地图。

std::map<std::string, int> aMap;
相关问题