declaration syntax error in main ()

newuserme's Avatar, Join Date: Nov 2011
Newbie Member
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;
    }

Last edited by shabbir; 30Nov2011 at 17:10.. Reason: Code blocks
0
newuserme's Avatar, Join Date: Nov 2011
Newbie Member
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;
    }

Last edited by shabbir; 30Nov2011 at 17:09.. Reason: Code blocks
0
newuserme's Avatar, Join Date: Nov 2011
Newbie Member
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;
    }

Last edited by shabbir; 30Nov2011 at 17:09.. Reason: Code blocks