dos_compilers/Borland Turbo C++ v1/EXAMPLES/PIXEL.CPP
2024-07-02 07:34:51 -07:00

27 lines
992 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* PIXEL.CPP--Example from Chapter 5 of User's Guide */
// PIXEL.CPP demonstrates the Point and Location classes
// compile with POINT2.CPP and link with GRAPHICS.LIB
#include <graphics.h> // declarations for graphics library
#include <conio.h> // for getch() function
#include "point.h" // declarations for Point and Location classes
int main()
{
// initialize the graphics system
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\bgi");
// move a point across the screen
Point APoint(100, 50); // Initial X, Y at 100, 50
APoint.Show(); // APoint turns itself on
getch(); // Wait for keypress
APoint.MoveTo(300, 150); // APoint moves to 300,150
getch(); // Wait for keypress
APoint.Hide(); // APoint turns itself off
getch(); // Wait for keypress
closegraph(); // Restore original screen
return 0;
}