我有一个用 C++17 编写的代码,将值 x 和 y 作为输入并给出一些值作为输出。我想将其更改为采用尽可能多的输入( x 和 y 值)并提供输出。代码中需要做哪些更改
代码中发生的事情是:通过一些 x 和 y 坐标,它会找到坐标号。
int main(void) {
const std::vector<Tile> tiles{ Tile(0),Tile(1),Tile(2),Tile(3) };
// Test values
const double x{ 3700 }; // want to add multiple entries here
const double y{ 11261 }; // want to add multiple entries here
// Check cell number
for (const Tile& tile : tiles) {
if (const auto [isInTile, cellNumber] = tile.getCellNumber(x, y); isInTile) {
std::cout << "\nCellnumber: " << cellNumber << "\n:)\n\n\n\n\n\n";
}
}
return 0;
}
我尝试了很多更改,但总是以一些错误结束,而且我是 C++ 的新手,我的主要语言是 python。