It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming C and C++ Forum Script-archive

Pyramid

Share your completed scripts.

Pyramid

Postby sevenaces on Thu May 10, 2007 6:12 pm

/*Pyramid.cpp.
This program creats a
Pyramid upto N steps
for example...
3 wil give
*
***
*****

*/

#include<iostream.h>
#include<ctype.h>

void main()
{
int n;
char opp;
cout<<"*************** Ultimate Pyramid ***************\n\n";
do
{

cout<<"Enter no. of Steps : ";
cin>>n;
for(int i=0; i<n; i++)
{
cout<<"\t";
for(int k=0;k<=n-i;k++)
cout<<" ";
for(int j=0; j<=i;j++)
cout<<"*";
for(int l=0; l<i; l++)
cout<<"*";
cout<<endl;
}
cout<<"\nGenerate More (Y-N) : ";
cin>>opp;
opp=toupper(opp);
}while(opp!='N');
}
User avatar
sevenaces
50+ Club
 
Posts: 63
Joined: Thu Sep 28, 2006 7:44 pm

Who is online

Users browsing this forum: No registered users and 0 guests