Gotoxy in Dev c++

however using gotoxy funxtion is quiet difficult in devc++ because there is no such header file present in dev c++ to use gotoxy function what we have to all do is that we have to create the function for positioning cursor in devc++

I am showing you here a simple example for using gotoxy function :

#include<stdio.h>
#include<conio.h>
#include<windows.h>
void gotoxy(short x, short y);    //here we declare the gotoxy function//
main()
{
 gotoxy(30,16);                      //now where we want to call  gotoxy function //
 printf("Hi i am,here");
 return 0;
}
void gotoxy(short x, short y)           //definition of gotoxy function//                                               
{
 COORD pos ={x,y};
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

Note that gotoxy is function name here i.e. you are able to change that it may be anything except keywords

No comments:

Post a Comment