Code :: Blocks C ++中的数组循环 [英] Array loop in Code::Blocks C++

查看:132
本文介绍了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.


这篇关于Code :: Blocks C ++中的数组循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆