Ncurese printing shapes problem

now that my problem is i want to print a shape like below but all my coding is invain coz its not hapenning so can any one correct my coding

the shape i want to print is

*
**
***
****
*****

starting coordinates are (5,20)

#include<ncurses.h>

void printshape(int row, int col);
void eraseshape(int row, int col);

int main()
{
initscr();
printshape(5,20);
getch();
endwin();
}


void printshape(int row,int col)
{
for(int x=row;x<10;x++)
{
for(int y=col;y<25;y++)
{
move(x,y);
printw("*");
}
}
}

void eraseshape(int row,int col)
{
for(int i=row;i<=row+col;i++)
{
for(int j=col;j<=row+col;j++)
{
move(i,j);
printw("*");
}
}
}
You can write
1
2
move(x,y);
printw("*");

as mvprintw ( x, y, "*" );

Then you forgot to refresh(); the screen, which is why you can't see the output.

I checked how ncurses work, and found out that ncurses.h is just a shortcut to curses.h <- you might want to include that. (possibly this will make compilation slightly faster?)
thank u vry it worked
Topic archived. No new replies allowed.