hi all,
i am trying to generate a pattern
1
121
12321
1234321
123454321
1234321
12321
121
1
but the code is not compiling
i am getting the foolowing errors
C:\Dev-Cpp\files\patterns.cpp:102: error: name lookup of `j' changed for new ISO `for' scoping
C:\Dev-Cpp\files\patterns.cpp:98: error: using obsolete binding at `j'
C:\Dev-Cpp\files\patterns.cpp:115: error: name lookup of `p' changed for new ISO `for' scoping
C:\Dev-Cpp\files\patterns.cpp:112: error: using obsolete binding at `p'
now i have not tackled such errors before . pls help.
here is the code
for(int i=1;i<=5;i++)
{
for(int s=4;s>=i;s++)
cout<<" ";
for(int j=1;j<=i;j++)
cout<<j;
if(i>=2)
{
for(int k=j-2;k>=1;k--)
cout<<k;
}
cout<<endl;
}
for(int m=1;m<5;m++)
{
for(int sp=1;sp<=m;sp++)
cout<<" ";
for(int p=1;p<5;p++)
cout<<p;
for(int t=p-2;t>=1;t--)
cout<<t;
cout<<endl;
}