小编Mus*_*nar的帖子

C++里面的变量名称改为

我有一些char变量,它们被命名为tb11,tb12,tb13,tb14,tb21,tb22,tb23,tb24,tb31 ....我想用for循环迭代更改变量名中的数字部分

for(int i = 1; i<=6 ; i++)
{
  for(int j = 1; j<=4 ; j++)
  {
      tb(i)(j).readText; //this is my problem
  }
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能像这样在for循环中更改变量名?

c++

-3
推荐指数
1
解决办法
146
查看次数

标签 统计

c++ ×1