I have a problem in Borland C++

Hello,I've writen a program in Borland C++.......I'm a beginner & I encounter a lot of problems..........
here is one;
the program I writen is :
1
1 2 1
1 2 3 2 1
1 2 1
1
but I still have trouble in runing my program........

#include
#include

int main()
{
int m,u,n;
cout<<"please enter an integer number:
"
cin>>n;
m=n;
do
{
int y=0;
for(int i=1;i<=n;y++)
cout<<" ";
for(int j=1;j<=n-y)
{cout<<j;
cout<<" ";
}
if (j==1)
cout<<endl;
else
for(int z=n;z>=0)
{cout<<z;
cout<<" ";
}
cout<<endl;
m--;
}
while(m!=0);
int k=0;
do
{
for(int i=1;i<=m+1;k++)
cout<<" ";
for(int j=1;j<=n-k-1)
{cout<<j;
cout<<" ";
}
if (n-k-1=1)
cout<<endl;
else
for(int n-k-1;n>=1)
{cout<<n-k-1;
cout<<" ";
}
cout<<endl;
u++;
}
while(u!=n)

getch();
return 0;
}

can you correct it?............please heEeeEEeEeEeEeElp!!!

Comments

  • First you should try to fix the program by looking at the error messages that the compiler gives.
    Also fix the for loops. A for statement always has three parts as explained here:
    http://cprogramminglanguage.net/c-for-loop-statement.aspx

    If that doesn't help, post the code and the expected output again and use code tags to keep the formatting. It's hard to read it the way it is now.

    Good luck!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion