Results 1 to 9 of 9
  1. #1
    ultahackers's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    139
    Reputation
    9
    Thanks
    73
    My Mood
    Amused

    How Draw C++ Shapes

    For Shape Class Use this code bellow....
    Code:
    class Shape {
    
    public:
       Shape(int newx, int newy);
       int getX();
       int getY();
       void setX(int newx);
       void setY(int newy);
       void moveTo(int newx, int newy);
       void rMoveTo(int deltax, int deltay);
       virtual void draw();
    
    private:
       int x;
       int y;
    };
    For the Shape .cpp use code bellow....
    Code:
    #include "Shape.h"
    
    // constructor
    Shape::Shape(int newx, int newy) {
       moveTo(newx, newy);
    }
    
    // accessors for x & y
    int Shape::getX() { return x; }
    int Shape::getY() { return y; }
    void Shape::setX(int newx) { x = newx; }
    void Shape::setY(int newy) { y = newy; }
    
    // move the shape position
    void Shape::moveTo(int newx, int newy) {
       setX(newx);
       setY(newy);
    }
    void Shape::rMoveTo(int deltax, int deltay) {
       moveTo(getX() + deltax, getY() + deltay);
    }
    
    // abstract draw method
    void Shape::draw() {
    }
    Now lets start with example class...... we do a easy shape...
    Code:
    Rectangle(int newx, int newy, int newwidth, int newheight);
       int getWidth();
       int getHeight();
       void setWidth(int newwidth);
       void setHeight(int newheight);
       void draw();
    
    private:
       int width;
       int height;
    };
    Now to draw the shape... add this code..
    Code:
    // draw the rectangle
    void Rectangle::draw() {
       cout << "Drawing a Rectangle at:(" << getX() << "," << getY() <<
          "), width " << getWidth() << ", height " << getHeight() << endl;
    }
    00000000000000000000000000
    And remember...
    #include "Shape.h"
    #include "Rectangle.h"
    #include <iostream.h>

    --------------------------------------------------
    To make a circle...
    Code:
    void Circle::draw() {
      cout << "Drawing a Circle at:(" << getX() << "," << getY() <<
          "), radius " << getRadius() << endl;
    You get it....
    -----------

    --------
    Credits
    computer engW
    VernonDozier
    Boomdocks
    CA*****(name is wrong to say)

  2. The Following 2 Users Say Thank You to ultahackers For This Useful Post:

    MrSkafighter (12-06-2010),PID3RMAN (12-03-2010)

  3. #2
    ultahackers's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    139
    Reputation
    9
    Thanks
    73
    My Mood
    Amused
    I will update you new code....
    Last edited by ultahackers; 12-03-2010 at 09:15 PM.

  4. #3
    Fabolous's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    192.168.1.01
    Posts
    2,706
    Reputation
    261
    Thanks
    682
    My Mood
    Paranoid
    Quote Originally Posted by ultahackers View Post
    // Own post>> Just tested it using and empty project it works.....
    Give pic? I dun believe you

  5. #4
    GodHack2's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    645
    Reputation
    38
    Thanks
    762
    My Mood
    Amused
    what does this gotta do with ca?





    beat this bitches ^^^^^^^

    Current Stats : Bored :/


    Respect list :
    Crash !
    Gordon'
    Markoj

  6. #5
    ultahackers's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    139
    Reputation
    9
    Thanks
    73
    My Mood
    Amused
    Quote Originally Posted by GodHack2 View Post
    what does this gotta do with ca?
    I dont know.. Make a hack with cool shape around it? wat else?

  7. #6
    Fabolous's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    192.168.1.01
    Posts
    2,706
    Reputation
    261
    Thanks
    682
    My Mood
    Paranoid
    Quote Originally Posted by ultahackers View Post
    I dont know.. Make a hack with cool shape around it? wat else?
    I made boobs with this. In CA i have a boob as my menu

  8. #7
    ultahackers's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    139
    Reputation
    9
    Thanks
    73
    My Mood
    Amused
    Quote Originally Posted by UnknownCoder View Post


    I made boobs with this. In CA i have a boob as my menu
    Hm....... see great idea?

  9. #8
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,863
    Reputation
    425
    Thanks
    8,598
    Quote Originally Posted by UnknownCoder View Post


    I made boobs with this. In CA i have a boob as my menu
    FUCK YEAH I AM USING THIS NOW!

  10. #9
    seeplusplus's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    Massachusetts
    Posts
    329
    Reputation
    8
    Thanks
    85
    Quote Originally Posted by UnknownCoder View Post


    I made boobs with this. In CA i have a boob as my menu
    You can't code shit... and shit can't code you...
    Goals:
    Green = Done
    Blue = Getting Somewhere
    Red = Not Done
    • Mouse Grid
    • PTC Method
    • Trigger Bot

    I'm trying to think of more stuff!