C++ 包含数组的结构

C++ 包含数组的结构,c++,arrays,debugging,struct,deque,C++,Arrays,Debugging,Struct,Deque,我有一个包含std::数组的deque 我想将其转换为包含结构的deque。 我制作的结构如下: struct New_Array { array<array<int,4>,4> tablee; int h; } Jim; 在您的示例中,PrintBoard的声明在dfs()中使用的位置之后。如果这是代码的结构方式,那么前面可能有另一个PrintBoard声明,它将数组作为参数。很可能你有一个旧的声明在那里的某个地方被你的包含所吸引 在使用之前,请尝试移动打印板的声明。

我有一个包含std::数组的deque

我想将其转换为包含结构的deque。 我制作的结构如下:

struct New_Array {
array<array<int,4>,4> tablee;
int h;
} Jim;

在您的示例中,
PrintBoard
的声明在
dfs()
中使用的位置之后。如果这是代码的结构方式,那么前面可能有另一个
PrintBoard
声明,它将数组作为参数。很可能你有一个旧的声明在那里的某个地方被你的包含所吸引


在使用之前,请尝试移动
打印板的声明。

您能将其形成一个代码块,我们可以尝试编译它(即,一个?我将上面的代码放入一个文件中,并编写了一个main(),它为我编译w/gccWhat line是错误的来源,它在您的示例中位于何处?问题是我已经这样声明了打印板:
void PrintBoard(array tt)
。右边的是这张
void打印板(新的阵列tt)
deque<New_Array> visited;
    void PrintBoard(New_Array tt) {
        using namespace std;
        for (int iRow = 0; iRow < 4; ++iRow) {
            for (int iCol = 0; iCol < 4; ++iCol) {
                cout << tt.tablee[iRow][iCol];
                cout << "  ";//This space helps so the numbers can be visable 
            //to the user 
}
            cout << endl;
        }

}
 #include <deque>
    #include <vector>
    #include <array>

    using namespace std;

    struct New_Array {
        array<array<int,4>,4> tablee;
        int h;
    }str_test,Jim;

    deque<New_Array> visited;

    void dfs()
    {
    PrintBoard(visited.front());//****the error is in this line****
    }

    void PrintBoard(New_Array tt) {
            using namespace std;
            for (int iRow = 0; iRow < 4; ++iRow) {
                for (int iCol = 0; iCol < 4; ++iCol) {
                    cout << tt.tablee[iRow][iCol];
                    cout << "  ";//This space helps so the numbers can be visable 
                //to the user 
            }
                cout << endl;
            }

            }

    int main() 
    {
        dfs();
        char test_char;
        cin>> test_char;
        return EXIT_SUCCESS;
    }