Friday, November 22
gotoxy() function in c++ by Umair Sajid
gotoxy() function :
The gotoxy function is used to to move the cursor to a specified location on the screen. Its Just Something Other then just Sequential Execution .It moves the cursor with respect to x axis and y axis. It is very useful when the output is to be displayed at a specified location on the screen.
Working:
The Variable x indicates x-axis. Its Value can be from 0 to 79. The Variable y indicates the y-axis. Its Value can be from 0 to 24.
Program:
#include// Header Files #include // for getch() function #include #include // Necessary when treating consoles using namespace std; void gotoxy (int x, int y) { COORD coordinates; // coordinates is declared as COORD coordinates.X = x; // defining x-axis coordinates.Y = y; //defining y-axis SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coordinates); } int main() { int x; int y; cout<<"Enter x: "; cin>>x; cout<<"Enter y: "; cin>>y; gotoxy(x,y); // function call cout<<"C++ Clan Umair Sajid"<<endl; getch(); return EXIT_SUCCESS; }
aah the long forgotten gotoxy() :)
ReplyDeleteUmair you did a wonderful job with this post (y)
ReplyDeleteAlso i am glad to announce that you have been one of the leading authors for past month :)
keep it up :)
ThankYou Sir Umar ,,, This encourages me to explore c++ and find something which is intersting to me ,,,, nd my clan ( C++ Clan )
ReplyDeleteActually we are making ludo project so ,,,, i think this is something helpful :) :)
ReplyDeleteYou know it's built-in in conio.h ?? but deprecated in visual studio.
ReplyDeleteWow 100% working
ReplyDeleteIt makes some errors?
ReplyDelete