.....................................................................................................................................................lo siento, Albatross.At least you're not the forum troll.
#include<iostream.h>
#include<conio.h>
void main()
{
int n;
cin>>n; //enter the no. of line to print
clrscr();
for(int i=0;i<n;i++) // 1st loop for new line print
{
for(int j = n-1;j>i;j--) // 2nd loop for space " " print
cout<<" ";
for(int k=0;k<=i;k++) // 3rd loop for left side triangle print
cout<<"*";
for(int m= 0;m<i;m++) // 4th loop for right side triangle print
cout<<"*";
cout<<"\n";
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void pattern(int m,int n) /*----function definition with formal arguments.---m for no. of pattrens and n for number of lines.
we can also take a,b,c,...z as formal arguments it does't matter */
{
for(int h=1;h<=m;h++)
for(int i=0;i<n;i++)
{
for(int j = n-1;j>i;j--)
{
cout<<" ";}
for(int k=0;k<=i;k++)
{
delay(150); //-----------just for fun i use delay function dude...
cout<<"*";
}
for(int m= 0;m<i;m++)
{
delay(150);
cout<<"*";
}
cout<<"\n";
}
}
void main(void)
{
int m,n;
clrscr();
cout<<"enter no. of patterns : ";
cin>>m;
cout<<"\nenter no.of lines to print : ";
cin>>n;
pattern(m,n); //function call...with actual arguments....
getch();
}
i create a function called "pattern" with args. m and n..u can take any name for arguments...it hardly mattres...
i use delay function from dos preproccesor directive...delay (100); means delay of 100 ms.