Hi all, since tomorrow i have an exam of C++ at school, i'm writing some functions and programms to take practice... I think that this class i'm sharing will be usefull to someone... It's a class with function used to draw something u want in the console by giving the x and y coordinates... It's easy to use i used it in a game created by me to move by keyboard a little character enjoy
Code:
class Coords{ public: int x,y;};
class Piano{ public: Coords punto; //give the x,y coords of the point
void DrawPoint(int spazio);//self explanatory xD
char* symbol;//the symbol you want to draw
};
void Piano::DrawPoint(int spazio)
{
for(int j=0; j<punto.y; j++)
cout<<"\n";
for(int j=0; j<punto.x; j++)
cout<<" ";
cout<<symbol;
for(int i=0; i<spazio; i++)
cout<<endl;
}
int main()
{
Piano a;
a.punto.x = 110;
a.punto.y = 210;
a.symbol = "X";
a.DrawPoint(5);
system("pause");
return 0;
}
The source has got the main function as test of the classes