0

如果我有一个 string 类型的 typedef 项,我如何使用 cout 将其打印出来?我不断收到“无法从typedefItemType转换为字符串”消息。

4

1 回答 1

0
typedef string MyStrings[2]; 

...

MyStrings names = { "Brandon", "Programmer" };

for(int i = 0; i < sizeof(names) / sizeof(string); i++)
{
   cout << names[i] << endl;
}
于 2010-12-18T08:03:23.653 回答