How to move the whole figure horizontally in c++

can any one tells me how to make the shown figure move horizontally

Note that: I wanna ask the user for the number of rows(lines) then, i will show the figure on the console so i must use nested loop which is dependent on the number of lines that user wants then, I should make it move from current position to the next position horizontally

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <windows.h>
using namespace std;

void figure1(int n);

 void gotoxy( int x, int y )
    {
    COORD p = { x, y };
    SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), p );
    }

int main()
{
    int i,j,k,n,x,y,fig;
       cout<<"Enter Size:"<<endl;
    cin>>n;

    cout<<"Enter Number of figure:"<<endl;
    cin>>fig;

    system ("CLS");

if(fig==1){
        for(x=0;x<1;x++){ //for horizontal line
            for(y=0;y<300;y++){  // for columns
            goto(x,y);
            figure1(n);
            }
        }
      }

return 0;
}

void figure1(int n){
    int i,j,k;
    for(j=1;j<=n;j++){
        for(k=j;k<=n;k++){
            cout<<" ";
        }
        for(i=1;i<=j;i++){
            cout<<"*";
        }
        cout<<endl;
    }
    }



Thanks in advance :)
line 27: take a closer look it is not gotoxy(...)
worked, but still cant move it horizontally
Topic archived. No new replies allowed.