This blog is under construction

Thursday, 12 September 2013

getmaxx example in c

Header file:
    graphics.h

Synopsis:
      int getmaxx (void);
     
Description:
     getmaxx () returns maximum value of x-axis for the current graphic screen.


getmaxx function in c graphics



  #include <stdio.h>
  #include <conio.h>
  #include <graphics.h>
  #include <dos.h>

  int main() {
        /* request auto detection */
        int graphicDriver = DETECT, graphicMode;
        int i, err, y, maxx;
        int circleRadius = 150;

        /* 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 x value */
        maxx = getmaxx();

        /* setting the current line style */
        setlinestyle(SOLID_LINE, 1, THICK_WIDTH);
        for (i = 0; i < getmaxy(); i = i + 25) {
                /*
                 * draws horizontal line from
                 * start to end of screen
                 */
                line(x, y + i, maxx, y + i);

                /* sleep for 100 milliseconds */
                delay(100);

        }

        /* clean up */
        getch();
        closegraph();
        return 0;
  }





Output: (getmaxx built-in function in c graphics.h)


No comments:

Post a Comment