0% found this document useful (0 votes)
381 views1 page

Gotoxy Function:: Program

The gotoxy function moves the cursor to a specified location on the screen defined by x and y coordinates. It defines x as the x-axis from 0 to 79 and y as the y-axis from 0 to 24. The program asks the user to input x and y values, calls the gotoxy function to move the cursor to that position, and prints text at the new location on the screen.

Uploaded by

Pragya Pandya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
381 views1 page

Gotoxy Function:: Program

The gotoxy function moves the cursor to a specified location on the screen defined by x and y coordinates. It defines x as the x-axis from 0 to 79 and y as the y-axis from 0 to 24. The program asks the user to input x and y values, calls the gotoxy function to move the cursor to that position, and prints text at the new location on the screen.

Uploaded by

Pragya Pandya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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:
?
1
2
3 #include <cstdlib> // Header Files
4 #include<conio.h> // for getch() function
5 #include <iostream>
#include<windows.h> // Necessary when treating consoles
6 using namespace std;
7 void gotoxy (int x, int y)
8 {
9 COORD coordinates; // coordinates is declared as COORD
10 coordinates.X = x; // defining x-axis
coordinates.Y = y; //defining y-axis
11 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coordinates);
12 }
13 int main()
14 {
int x;
15
int y;
16
17 cout<<"Enter x: ";
18 cin>>x;
19 cout<<"Enter y: ";
20 cin>>y;
21
gotoxy(x,y); // function call
22 cout<<"C++ Clan Umair Sajid"<<endl;
23 getch();
24 return EXIT_SUCCESS;
25 }
26 </windows.h></iostream></conio.h></cstdlib>
27
28

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy