Treasure of Knowledge

Skip to content

Send email to tutor@visharadsoftware.com if you want online tuition

C++(not a difiicult one)

C++(not a difiicult one)

Postby Aggyness_90 on Sun Apr 18, 2010 5:41 am

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
the stars mean space.
but I still have trouble in runing my program........

#include<iostream.h>
#include<conio.h>

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

getch();
return 0;
}

can you correct it?............or if you think you have a better idea,can you write me another program for my project??............please heEeeEEeEeEeEeElp!!!
Aggyness_90
 
Posts: 8
Joined: Fri Sep 19, 2008 12:50 pm

Return to Others

Who is online

Users browsing this forum: No registered users and 1 guest