d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help With Assignment C++ > Paying Fg
12Next
Add Reply New Topic New Poll
Member
Posts: 541
Joined: May 5 2013
Gold: 596.78
May 9 2014 03:55am
here is a little code that shows a little bit of how it looks like
http://wrttn.in/9d781a


and this is the assignment
https://www.mediafire.com/?itnin4n6w144ts9
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
May 9 2014 08:34am
What's the issue
Member
Posts: 9,803
Joined: Jun 28 2005
Gold: 6.67
May 9 2014 08:56am
I assume he wants it done with little input from himself.
Member
Posts: 541
Joined: May 5 2013
Gold: 596.78
May 9 2014 09:35am
Quote (KrzaQ2 @ May 9 2014 05:56pm)
I assume he wants it done with little input from himself.


^ yub
got other assignments on my hand so i can't focus on it , and well for a fair price i'd like to see it done

This post was edited by ebe222 on May 9 2014 09:37am
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
May 9 2014 05:23pm
Quote (ebe222 @ May 9 2014 10:35am)
^ yub
got other assignments on my hand so i can't focus on it , and well for a fair price i'd like to see it done


2000fg
Member
Posts: 541
Joined: May 5 2013
Gold: 596.78
May 9 2014 08:00pm
Quote (Minkomonster @ May 10 2014 02:23am)
2000fg

k
tell me when its done
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
May 9 2014 08:06pm
Quote (ebe222 @ May 9 2014 09:00pm)
k
tell me when its done


Hmm, maybe I undershot it. Was just trying to gauge what you felt was reasonable.
Member
Posts: 541
Joined: May 5 2013
Gold: 596.78
May 9 2014 08:41pm
Quote (Minkomonster @ May 10 2014 05:06am)
Hmm, maybe I undershot it. Was just trying to gauge what you felt was reasonable.


2k is reasonable
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
May 9 2014 11:20pm
Code
#include <windows.h>
#include <iostream>

class Shape
{
public:
Shape(int _x, int _y, char _letter, int _length):
x(_x), y(_y), letter(_letter), length(_length){}
void verLine();
void horLine();
void diagLine(int,int);
void setLetter(char value){ letter = value; }
void setLength(int value) { length = value; }
void gotoxy(int, int);
protected:
char letter;
int x,y, length;
};

void Shape::gotoxy(int x, int y)
{ //To move cursor to certain location
HANDLE hConsole;
COORD cursorLoc;
std::cout.flush();
cursorLoc.X = x;
cursorLoc.Y = y;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsole, cursorLoc);
}

void Shape::horLine()
{
gotoxy(x,y);
for (int i=0; i<length; i++)
std::cout << letter;
}

void Shape::verLine()
{
for (int i=0; i<length; i++)
{
gotoxy(x,y+i);
std::cout << letter;
}
}

void Shape::diagLine(int toX, int toY)
{
int dx = toX - x < 0 ? -1 : 1;
int dy = toY - y < 0 ? -1 : 1;

for(int _x=x,_y=y; _x != toX && _y != toY;_x+=dx,_y+=dy)
{
gotoxy(_x,_y);
std::cout << letter;
}




}

class REctangle : public Shape
{
public:
REctangle(int x, int y, char letter, int _width, int _height):
Shape(x,y,letter,0),
width(_width),height(_height){}
void virtual draw();
protected:
int width, height;
};

void REctangle::draw()
{
setLength(height);
verLine();
setLength(width);
horLine();

x += width-1;
setLength(height);
verLine();

x-=width-1;
y+= height-1;
setLength(width);
horLine();
y-=height-1;
}

class Box : public REctangle
{
public:
Box(int x, int y, char letter, int width, int length, int _depth):
REctangle(x,y,letter,width,length), depth(_depth){}
void draw();
protected:
int depth;

};

void Box::draw()
{

REctangle::draw();
x+=depth;
y+=depth;
REctangle::draw();
x-=depth;
y-=depth;
diagLine(x+depth,y+depth);
x+=width;
diagLine(x+depth,y+depth);
x-=width;
y+=height;
diagLine(x+depth,y+depth);
x+=width;
diagLine(x+depth,y+depth);
x-=width;
y-=height;

}


class Triangle : public Shape
{
public:
Triangle(int x, int y, char letter, int _base, int _height):
Shape(x,y,letter,0), base(_base),height(_height){}
void draw();
protected:
int base, height;


};

void Triangle::draw()
{
diagLine(x-height/2,y+height);
diagLine(x+height/2,y+height);


int _x = x;
int _y = y;
x = x-height/2+1;
y = y+height/2-1;
setLength((base)-1);
horLine();
x = _x;
y = _y;

}

int main()
{
Shape s = Shape(10,50,'|',10);
REctangle r = REctangle(10,50,'*',10,5);
Box b = Box(10,10,'#',50,30,10);
Triangle t = Triangle(40,30,'#',10,10);
Triangle t2 = Triangle(50,30,'#',10,10);
Triangle t3 = Triangle(40,25,'#',10,10);
s.verLine();
r.draw();
b.draw();
t.draw();
t2.draw();
t3.draw();



char c;
std::cin >> c;

}




its a Box with a triforce in it. With like a flag lookin thing outside.
Member
Posts: 541
Joined: May 5 2013
Gold: 596.78
May 10 2014 12:13am
Quote (Minkomonster @ May 10 2014 08:20am)
Code
#include <windows.h>
#include <iostream>

class Shape
{
    public:
        Shape(int _x, int _y, char _letter, int _length):
            x(_x), y(_y), letter(_letter), length(_length){}
        void verLine();
        void horLine();
        void diagLine(int,int);
        void setLetter(char value){ letter = value; }
        void setLength(int value) { length = value; }
        void gotoxy(int, int);
    protected:
        char letter;
        int x,y, length;
};

void Shape::gotoxy(int x, int y)
{ //To move cursor to certain location
  HANDLE hConsole;
  COORD cursorLoc;
  std::cout.flush();
  cursorLoc.X = x;
  cursorLoc.Y = y;
  hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleCursorPosition(hConsole, cursorLoc);
}

void Shape::horLine()
{
    gotoxy(x,y);
    for (int i=0; i<length; i++)
        std::cout << letter;
}

void Shape::verLine()
{
    for (int i=0; i<length; i++)
    {
        gotoxy(x,y+i);
        std::cout << letter;
    }
}

void Shape::diagLine(int toX, int toY)
{
    int dx = toX - x < 0 ? -1 : 1;
    int dy = toY - y < 0 ? -1 : 1;

    for(int _x=x,_y=y; _x != toX && _y != toY;_x+=dx,_y+=dy)
    {
      gotoxy(_x,_y);
      std::cout << letter;
    }




}

class REctangle : public Shape
{
    public:
        REctangle(int x, int y, char letter, int _width, int _height):
            Shape(x,y,letter,0),
            width(_width),height(_height){}
        void virtual draw();
    protected:
        int width, height;
};

void REctangle::draw()
{
  setLength(height);
  verLine();
  setLength(width);
  horLine();

  x += width-1;
  setLength(height);
  verLine();

  x-=width-1;
  y+= height-1;
  setLength(width);
  horLine(); 
  y-=height-1;
}

class Box : public REctangle
{
    public:
        Box(int x, int y, char letter, int width, int length, int _depth):
        REctangle(x,y,letter,width,length), depth(_depth){}
        void  draw();
    protected:
        int depth;

};

void Box::draw()
{

    REctangle::draw();
    x+=depth;
    y+=depth;
    REctangle::draw();
    x-=depth;
    y-=depth;
    diagLine(x+depth,y+depth);
    x+=width;
    diagLine(x+depth,y+depth);
    x-=width;
    y+=height;
    diagLine(x+depth,y+depth);
    x+=width;
    diagLine(x+depth,y+depth);
    x-=width;
    y-=height;

}


class Triangle : public Shape
{
    public:
        Triangle(int x, int y, char letter, int _base, int _height):
            Shape(x,y,letter,0), base(_base),height(_height){}
        void draw();
    protected:
        int base, height;


};

void Triangle::draw()
{
    diagLine(x-height/2,y+height);
    diagLine(x+height/2,y+height);


  int _x = x;
  int _y = y;
  x = x-height/2+1;
  y = y+height/2-1;
  setLength((base)-1);
    horLine();
    x = _x;
    y = _y;

}

int main()
{
    Shape s = Shape(10,50,'|',10);
    REctangle r = REctangle(10,50,'*',10,5);
    Box b = Box(10,10,'#',50,30,10);
    Triangle t = Triangle(40,30,'#',10,10);
    Triangle t2 = Triangle(50,30,'#',10,10);
    Triangle t3 = Triangle(40,25,'#',10,10);
    s.verLine();
    r.draw();
    b.draw();
    t.draw();
    t2.draw();
    t3.draw();



    char c;
    std::cin >> c;

}



its a Box with a triforce in it. With like a flag lookin thing outside.


that's uhhh great and all but did you see the examples on the assignment ? you can move the objects and the code i provided also moves the object
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll