Loading ...
Sorry, an error occurred while loading the content.

File - CIRCLE1.CPP

Expand Messages
  • ibi_edu@yahoogroups.com
    #include #include #include #include #include class Circle { private : // help // // midx and midy are
    Message 1 of 201 , Nov 1, 2009
    View Source
    • 0 Attachment
      #include<stdio.h>
      #include<iostream.h>
      #include<conio.h>
      #include <graphics.h>
      #include <stdlib.h>
      class Circle
      {
      private :
      // help //
      // midx and midy are used pixel on the mid of the screen
      int midx, midy;
      // move_x and move_y are used to move circle along x-axis and y-axis
      int move_x,move_y;
      //--help--//
      int radius;

      public:
      void get_radius();
      void get_x_axis();
      void get_y_axis();
      void center_of_screen();
      void draw_circle();
      void put_pixel();
      };

      void Circle::get_radius()
      {
      cout<<"\n\n\n\t\t Enter the radius of the circle : ";
      cin>>radius;
      }
      void Circle::get_x_axis()
      {
      cout<<"\t\t Enter the value of x to move the circle : ";
      cin>>move_x;

      }

      void Circle::get_y_axis()
      {
      cout<<"\t\t Enter the value of y to move the circle : ";
      cin>>move_y;

      }
      void Circle::center_of_screen()
      {
      midx = 319;
      midy = 239;
      }
      void Circle::draw_circle()
      {

      /* draw the circle */
      circle(midx+move_x, midy-move_y, radius);
      /* clean up */
      getch();
      }

      void Circle::put_pixel()
      {
      putpixel(319+move_x, 239-move_y,15);
      getch();
      }

      void main(void)
      {
      Circle circle;
      clrscr();

      circle.get_radius();
      circle.get_x_axis();
      circle.get_y_axis();
      circle.center_of_screen();
      clrscr();

      /* request auto detection */
      int gdriver = DETECT, gmode;

      /* initialize graphics and local variables */
      initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

      circle.put_pixel();
      circle.draw_circle();

      closegraph();

      getch();


      }
    • ibi_edu@yahoogroups.com
      #include #include #include #include #include class Circle { private : // help // // midx and midy are
      Message 201 of 201 , Apr 13 2:38 AM
      View Source
      • 0 Attachment
        #include<stdio.h>
        #include<iostream.h>
        #include<conio.h>
        #include <graphics.h>
        #include <stdlib.h>
        class Circle
        {
        private :
        // help //
        // midx and midy are used pixel on the mid of the screen
        int midx, midy;
        // move_x and move_y are used to move circle along x-axis and y-axis
        int move_x,move_y;
        //--help--//
        int radius;

        public:
        void get_radius();
        void get_x_axis();
        void get_y_axis();
        void center_of_screen();
        void draw_circle();
        void put_pixel();
        };

        void Circle::get_radius()
        {
        cout<<"\n\n\n\t\t Enter the radius of the circle : ";
        cin>>radius;
        }
        void Circle::get_x_axis()
        {
        cout<<"\t\t Enter the value of x to move the circle : ";
        cin>>move_x;

        }

        void Circle::get_y_axis()
        {
        cout<<"\t\t Enter the value of y to move the circle : ";
        cin>>move_y;

        }
        void Circle::center_of_screen()
        {
        midx = 319;
        midy = 239;
        }
        void Circle::draw_circle()
        {

        /* draw the circle */
        circle(midx+move_x, midy-move_y, radius);
        /* clean up */
        getch();
        }

        void Circle::put_pixel()
        {
        putpixel(319+move_x, 239-move_y,15);
        getch();
        }

        void main(void)
        {
        Circle circle;
        clrscr();

        circle.get_radius();
        circle.get_x_axis();
        circle.get_y_axis();
        circle.center_of_screen();
        clrscr();

        /* request auto detection */
        int gdriver = DETECT, gmode;

        /* initialize graphics and local variables */
        initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

        circle.put_pixel();
        circle.draw_circle();

        closegraph();

        getch();


        }
      Your message has been successfully submitted and would be delivered to recipients shortly.