我的问题是这样的:假设我有 3 个变量(i = 1,j = 2,k =3)我想这样做:“a = 0.ijk”所以 a == 0.123 但这些变量在多个 for 下所以我将它们的值保存在数组上..
我尝试使用 sstream 将它们从字符串转换为 int (123) 然后我将其除以 1000 得到 0.123 但它不起作用...
float arrayValores[ maxValores ];
ostringstream arrayOss[ maxValores ];
...
arrayOss[indice] << i << j << k;
istringstream iss(arrayOss[indice].str());
iss >> arrayValores[indice];
arrayValores[indice] = ((arrayValores[indice])/1000)*(pow(10,z)) ;
cout << arrayValores[indice] << " ";
indice++;
有人可以帮助我吗?