I am required to Develop a function called Block(..) to draw a block in the centre of the screen at position (40,12). The user must input the size of the block by entering the number of characters.

The function must determine the co-ordinates of the block (Block must still be in the centre of the screen !
Example user enters 4 x 4.(This would mean 4 columns and 4 rows).

While loops and gotoxy (..) function must be used. Two other functions must also be created called vert_line(..) And horz_line(..) to help with the drawing of the block.

I have tried to use gotoxy to print a box but it does not print the characters in the correct places.

Code:
#include<windows.h> //  header file for gotoxy
 #include <stdio.h>     //header file for standard input output








 void Block(void);
 //Copy this code below in the main function.


//_____________________________________Function GOTOXY(..)__________________________________________


COORD coord={0,0}; // this is global variable
                                    //center of axis is set to the top left cornor of the screen
 void gotoxy(int x,int y)
 {
   coord.X=x;
 coord.Y=y;
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
 }


//_____________________________________End Function GOTOXY(..)______________________________________












void main()
//int x,y;


{


//gotoxy(10,10);//calling this function. General Form:gotoxy(Column,Row); Values should be integers!
//printf("%c",187);
Block();
  }


  void Block(void)
  {
      int column,row,c,r,x,y;
      c=40;
      r=12;
      printf("Enter the size of the block [must be an evan intiger eg: 2X4 or 4x2]. (columns,rows)\n");
      printf("columns: ");
      scanf("%d", &column);
      printf("rows: ");
      scanf("%d", &row);




      while(c>=40-column)
      {
        gotoxy(c+(column/2),r);
        printf("%c",196);
        c--;
      }


   
  //gotoxy(40-(column/2),r+2);
  while(r<12+row)
  {
      gotoxy(40-(column/2),r+1);
      printf("%c\n",179);
      r++;
  }


  gotoxy(40-(column/2),r+row+1);
   while(c<40+column)
      {
        gotoxy(c-column/2,r+1);
        printf("%c",196);
        c++;
      }


 /* while(r>12)
  {
      printf("%c",179);
      r--;
  }*/




  }
if anyone can comprehend the question and give suggestions i would really appreciate it.