Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   declaration syntax error in main () (http://www.go4expert.com/forums/declaration-syntax-error-main-t27255/)

newuserme 30Nov2011 15:51

declaration syntax error in main ()
 
hey everyone ,m trying to do a program that displays the Olympic symbols using bresenham's algorithm but i keep getting declaration syntax error in main,pls help
i can't see any problem with it

Code:

#include<iostream.h>
  #include<graphics.h>
  #include<conio.h>
  #include<math.h>
  #include<stdlib.h>
  #include<stdio.h>

    void circlePlotPoints(int xc,int yc,int x,int y)


  int  main()

  {

      int gd=DETECT,gm;
      initgraph(&gd,&gm,"");
      clrscr();

      setbkcolor(WHITE);

    setcolor(CYAN);
    drawCircle(100,100,35);

  setcolor(BLUE);
  drawCircle(175,100,35);

  setcolor(RED);
  drawCircle(250,100,35);

  setcolor(YELLOW);
  drawCircle(140,150,35);

  setcolor(GREEN);
  drawCircle(210,150,35);


    void circlePlotPoints(int xc,int yc,int x,int y)
  {
    putpixel(xc+x,yc+y,1);
    putpixel(xc-x,yc+y,1);
    putpixel(xc+x,yc-y,1);
    putpixel(xc-x,yc-y,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc+x,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc-x,1);
    putpixel(xc+y,yc-x,1);
    }


    void drawCircle (int xc,int yc,int radius)
    {
      int x=0;
      int y=radius;
      int p=1-radius;

    circlePlotPoints(xc,yc,x,y);

    while(x<=y)
    {
      x++;
      if(p<0)

        p=p+2*x+1;

      else
      {
        y--;
        p =p+2*(x-y)+1;
      }
      circlePlotPoints(xc,yc,x,y);
    }

  getch();

  }
 return 0;
    }


newuserme 30Nov2011 15:53

Re: declaration syntax error in main ()
 
sorry modified code is this


Code:

#include<iostream.h>
  #include<graphics.h>
  #include<conio.h>
  #include<math.h>
  #include<stdlib.h>
  #include<stdio.h>

    void circlePlotPoints(int xc,int yc,int x,int y)


  int  main()

  {

      int gd=DETECT,gm;
      initgraph(&gd,&gm,"");
      clrscr();

      setbkcolor(WHITE);

    setcolor(CYAN);
    drawCircle(100,100,35);

  setcolor(BLUE);
  drawCircle(175,100,35);

  setcolor(RED);
  drawCircle(250,100,35);

  setcolor(YELLOW);
  drawCircle(140,150,35);

  setcolor(GREEN);
  drawCircle(210,150,35);


    void circlePlotPoints(int xc,int yc,int x,int y)
  {
    putpixel(xc+x,yc+y,1);
    putpixel(xc-x,yc+y,1);
    putpixel(xc+x,yc-y,1);
    putpixel(xc-x,yc-y,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc+x,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc-x,1);
    putpixel(xc+y,yc-x,1);
    }


    void drawCircle (int xc,int yc,int radius)
    {
      int x=0;
      int y=radius;
      int p=1-radius;

        circlePlotPoints(xc,yc,x,y);

        while(x<=y)
        {
          x++;
          if(p<0)

            p=p+2*x+1;

          else
          {
            y--;
            p =p+2*(x-y)+1;
          }
      circlePlotPoints(xc,yc,x,y);
    }

  getch();

  }
 return 0;
    }


newuserme 30Nov2011 15:57

Re: declaration syntax error in main ()
 
Code:

#include<iostream.h>
  #include<graphics.h>
  #include<conio.h>
  #include<math.h>
  #include<stdlib.h>
  #include<stdio.h>


    void circlePlotPoints(int xc,int yc,int x,int y)

  {
    putpixel(xc+x,yc+y,1);
    putpixel(xc-x,yc+y,1);
    putpixel(xc+x,yc-y,1);
    putpixel(xc-x,yc-y,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc+x,1);
    putpixel(xc+y,yc+x,1);
    putpixel(xc-y,yc-x,1);
    putpixel(xc+y,yc-x,1);
    }


    void drawCircle (int xc,int yc,int radius)
    {
      int x=0;
      int y=radius;
      int p=1-radius;

        circlePlotPoints(xc,yc,x,y);

        while(x<=y)
        {
          x++;
          if(p<0)

            p=p+2*x+1;

          else
          {
            y--;
            p =p+2*(x-y)+1;
          }
      circlePlotPoints(xc,yc,x,y);
    }


  int  main()

  {// get the error here

      int gd=DETECT,gm;
      initgraph(&gd,&gm,"");
      clrscr();

      setbkcolor(WHITE);
   
   

    setcolor(CYAN);
    drawCircle(100,100,35);

  setcolor(BLUE);
  drawCircle(175,100,35);

  setcolor(RED);
  drawCircle(250,100,35);

  setcolor(YELLOW);
  drawCircle(140,150,35);

  setcolor(GREEN);
  drawCircle(210,150,35);
   


  getch();

  }
 return 0;
    }



All times are GMT +5.5. The time now is 11:38.