Header file:
graphics.h
Synopsis:
int getmaxy (void);
Description:
getmaxy () returns maximum value of y-axis for the current graphic screen.
getmaxy function in c graphics
#include <conio.h>
#include <graphics.h>
#include <dos.h>
int main() {
/* request auto detection */
int graphicDriver = DETECT, graphicMode;
int i, err, x, y, maxy;
/* initialize graphics system */
initgraph(&graphicDriver, &graphicMode, "C:/TURBOC3/BGI");
err = graphresult();
if (err != grOk) {
/* error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
return 0;
}
x = y = 0;
/* maximum y value */
maxy = getmaxy();
/* setting the current line style */
setlinestyle(SOLID_LINE, 1, THICK_WIDTH);
for (i = 0; i < getmaxx(); i = i + 25) {
/*
* draws vertical line from
* start to end of screen
*/
line(x + i, y, x + i, maxy);
/* sleep for 100 milliseconds */
delay(100);
}
/* clean up */
getch();
closegraph();
return 0;
}
Output: (getmaxy built-in function in c graphics.h)
No comments:
Post a Comment