#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Somewhere over the Rainbow
    Posts
    128
    Rep Power
    11

    Question Enlarge Circle in C


    The code do something that when I press the up arrow the circle enlarge, and when I press the down arrow the circle dimishes, doesnt have errors!, but doesnt enlarge and diminish, what is the problem?

    Thanks

    Code:
    #include <graphics.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <conio.h>
    
    int main(void)
    {
       /* Detecion del Driver */
       char c;
       int gdriver = DETECT, gmode, errorcode;
       int midx, midy;
       int radius = 100;
    
       /* inicia grafica y variables locales */
       initgraph(&gdriver, &gmode, "");
    
       /* lee resultados del inicio de grafica */
       errorcode = graphresult();
       if (errorcode != grOk)  /* si ocurre un error */
       {
          printf("Grafica error: %s\n", grapherrormsg(errorcode));
          printf("Pressione cualquier tecla para salir:");
          getch();
          exit(1); /* termina el error */
       }
    
       midx = getmaxx() / 2;
       midy = getmaxy() / 2;
       setcolor(3);
    
       /* dibuja el circulo */
       circle(midx, midy, radius);
    
        do {
        c=getchar();
        if(c=='+') radius++;
        if(c=='-') radius--;
        } while (c!='q');
    
       /* limpia */
       getch();
       closegraph();
       return 0;
    }
    Last edited by Gerardoj; August 27th, 2003 at 04:05 PM.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Somewhere over the Rainbow
    Posts
    128
    Rep Power
    11
    now works , thanks
  4. #3
  5. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    Could you post back the working version?

    Also, just answer two questions for a nosey parker :D : What platform are you developing for? and what IDE/compiler are you using?

    christo
    This is me: http://chris.uk.com
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Smells like DOS and an early Turbo-C compiler. Those functions (initgraph(), getmaxx(), getmaxy() etc.) are definitely from the BGI (Borland Graphic Interface) library.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    Smells like DOS and an early Turbo-C compiler. Those functions (initgraph(), getmaxx(), getmaxy() etc.) are definitely from the BGI (Borland Graphic Interface) library.
    exactly what I thought, which is why I asked :D
    Bit of a blast from the past innit

    cx
    This is me: http://chris.uk.com

IMN logo majestic logo threadwatch logo seochat tools logo