Code :: Blocks C ++中的数组循环

问题描述:

我刚刚在codeblocks中用c ++玩过昨天。我创建了一个包含2行和3列的数组,我想打印这些值。



但是当我在Code :: Blocks中运行构建和调试按钮时来自编译器的错误(我使用gcc)



Hi, I just played yesterdays with c++ in codeblocks. I created an array with 2 rows and 3 columns and I wanted to print the values.

But when I run the build and debug button in Code::Blocks I take this errror from the compiler (I use gcc)

||=== Build: Debug in loops (compiler: GNU GCC Compiler) ===|
C:\Users\Posd\Documents\C++\loops\loops.cpp|13|error: 'colums' was not declared in this scope|
||=== Build failed: 1 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|





我的代码如下,我无法理解我做错了什么。





My code is the following and I caouldn't understand what I doing wrong.

#include <iostream>

using namespace std;

main()
{
        int array[2][3] = {{5,8,9,},{2,5,6}};

        for(int rows = 0;rows<2;rows++)
        {
            for(int columns=0;columns<3;columns++)
            {
                cout << array[rows][columns] << " ";
            }

            cout << endl;
        }
}

我解决了! :P $ / $


循环中的上升语句中的名称列是列。我解决了。
I solve it! :P

The name columns in the increase statement in loop was colums. I fix it.