Can you please help me do a asterisks of pyramid using the drawbar function, im new to c++ please help. Thank you in advance
this is the drawbar function:

the output should look like:
  *
 ***
*****

*******

  /*Overloaded drawbar() program.*/
#include<iostream.h>
void DrawBar(int Length)
/*Diplays a bar of asterisks of length Length.
  Length assumed>=0 */

  const char Mark= '*';
  for (int i=0; i<Length; i++)
  cout<<Mark;
  cout<<endl;
  }
  void DrawBar(int Length, char Mark)
  /*Diplays a bar of length Length using character Mark.
  Length assumed>=0 */
  { 
    for (int i=0; i<Length; i++)
    cout<<Mark;
    cout<<endl;
   }
   int main()
    {
    DrawBar();
    DrawBar();
    DrawBar();
    DrawBar();
    return();
    }

Your asteriks are uneven.
You could center a number of asteriks in a string of blanks(if the chars are equiditant, but I guess that is the case here) and cout the string.

commented: how do i do that? sorry im new in c++ +0

what should i do to make it a pyramid?

Learn what an array is,learn what a forloop does.
That is the purpose of this exercise.

include <iostream>

using namespace std;

//Modify your way

//main

int i , j , lp , ishave ;

lp = ishave = 3; // <-- change number 1 , 2 , 3 , 4 , 5 , 6 ... more ^^

bool PutCheck = false;

int putcount = 1;

for( i=0; i<lp; i++ ){

    for( j=0; j<( lp*2 - 1 ); j++ ){

        if( ( ishave - 1 ) > j || ( ishave - 2 + putcount ) < j ){
            PutCheck = false;
        }else{
            PutCheck = true;
        }

        cout << ( PutCheck == true ? "*" : " " ) ;
    }

    ishave--;

    putcount+=2;

    cout << endl;

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.