Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

i want to do a magic box using the function gotoxy using this file please

+1 vote
asked Dec 10, 2019 by power of brain (130 points)
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void gotoxy(int ,int );
int main()
        {
          return 0;
        }

void gotoxy(int x, int y)
{
  static HANDLE h = NULL;
  if(!h)
    h = GetStdHandle(STD_OUTPUT_HANDLE);
  COORD c = { x, y };
  SetConsoleCursorPosition(h,c);
}

1 Answer

0 votes
answered Dec 18, 2019 by Prakash Rockez (260 points)

program:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void gotoxy(int ,int );
int main()
{
  gotoxy(10,10);
  return 0;
 }

void gotoxy(int x, int y)
{
  static HANDLE h = NULL;
  if(!h)
  h = GetStdHandle(STD_OUTPUT_HANDLE);
  COORD c = { x, y };
  SetConsoleCursorPosition(h,c);
}

output:


Process returned 0 (0x0)   execution time : 0.016 s
Press any key to continue.

commented Dec 18, 2019 by Prakash Rockez (260 points)
the magic box is created when executed in code blocks in c program
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...