使用数组值作为乘数?

时间:2015-05-26 00:21:17

标签: c++ string

说我有:

array[i]
// and array[4] was the value of 5
// I think something like this works in C++ array[4]*array[4] would give me 25

是否有某种方式对字符串做同样的事情或者是C ++中唯一的循环,因为我记得在Python中你可以做类似的事情:

"string"*4
// would give you "stringstringstringstring"

0 个答案:

没有答案