我正在尝试将“地图”读入我的程序。这是一个 100 个数字的列表,我希望它是一个 10 x 10 数组。我正在尝试使用 void 函数来读取文件。
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
const int rows = 10, columns = 10, inaccessible = 0, start = 1, victory = 2;
typedef unsigned int world[rows][columns];
void loadWorld (world map[rows][columns]);
int main()
{
cout << "Welcome to my game! Get to the bottom of the volcano to win." << endl;
for (int i = 0; i < rows; i++)
{
for(int j = 0; j < columns; j++)
cout << world[i][j];
}
return 0;
}
void loadWorld (world map[rows][columns])
{
ifstream inData;
inData.open("world.txt");
}