标题:这个抱错是怎么回事?
取消只看楼主
飞跃的乌龟
Rank: 2
等 级:论坛游民
帖 子:96
专家分:18
注 册:2012-10-20
结帖率:90.32%
已结贴  问题点数:20 回复次数:1 
这个抱错是怎么回事?
程序代码:
#include<iostream>
using namespace std;
int main()
{
    const int N=4;
    for(int i=1;i<=N;i++)
    {
        for(int j=1;j<=30;j++)
            cout<<' ';
        for(int j=1;j<=8-2*i;j++)
            cout<<' ';
        for(int j=1;j<=2*i-1;j++)
            cout<<'*';
        cout<<endl;
    }
    for(int i=1;i<=N-1;i++)
    {
        for(int j=1;j<=30;j++)
            cout<<' ';
        for(int j=1;j<=7-2*i;j++)
            cout<<'*';
        cout<<endl;
    }
    return 0;
}

目的是输出一个图形
          *
        ***
      *****
    *******
    *****
    ***
    *
我是初学的,这段是书上抄的,抱错如下
--------------------Configuration: fwef - Win32 Debug--------------------
Compiling...
fwef.cpp
E:\VC++\fwef.cpp(10) : error C2374: 'j' : redefinition; multiple initialization
        E:\VC++\fwef.cpp(8) : see declaration of 'j'
E:\VC++\fwef.cpp(12) : error C2374: 'j' : redefinition; multiple initialization
        E:\VC++\fwef.cpp(8) : see declaration of 'j'
E:\VC++\fwef.cpp(16) : error C2374: 'i' : redefinition; multiple initialization
        E:\VC++\fwef.cpp(6) : see declaration of 'i'
E:\VC++\fwef.cpp(20) : error C2374: 'j' : redefinition; multiple initialization
        E:\VC++\fwef.cpp(18) : see declaration of 'j'
执行 cl.exe 时出错.
2013-04-14 19:43
飞跃的乌龟
Rank: 2
等 级:论坛游民
帖 子:96
专家分:18
注 册:2012-10-20
得分:0 
回复 2楼 jiapengyun
重载是什么
2013-04-14 19:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-404174-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.082784 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved