This week i have exams of calculus, advanced algebra, programming and analitic geometry.
If someone start it, i\'ll be glad to join it, if not, i\'ll do it the next week.
By the way, if someone study math, and know the C language, try to run this code. It draws Hilbert\'s curves.
#include
#include
#include
#include
void graficos ();
void inicio ();
void linea (char,int,int*,int*);
void curvaA (int,int,int*,int*);
void curvaB (int,int,int*,int*);
void curvaC (int,int,int*,int*);
void curvaD (int,int,int*,int*);
void main (){
graficos();
do{cleardevice();
inicio();
printf(\"Otra vez? (S/N)\");
}while(toupper(getche())==\'S\');
closegraph;
}
void graficos (){
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,\"h:\\\\bgi\");
}
void curvaA (int c,int t,int*x,int*y){
if (c>0){curvaD(c-1,t,x,y);
linea(\'O\',t,x,y);
curvaA(c-1,t,x,y);
linea(\'S\',t,x,y);
curvaA(c-1,t,x,y);
linea(\'E\',t,x,y);
curvaB(c-1,t,x,y);}}
void curvaB (int c,int t,int*x,int*y){
if (c>0){curvaC(c-1,t,x,y);
linea(\'N\',t,x,y);
curvaB(c-1,t,x,y);
linea(\'E\',t,x,y);
curvaB(c-1,t,x,y);
linea(\'S\',t,x,y);
curvaA(c-1,t,x,y);}}
void curvaC (int c,int t,int*x,int*y){
if (c>0){curvaB(c-1,t,x,y);
linea(\'E\',t,x,y);
curvaC(c-1,t,x,y);
linea(\'N\',t,x,y);
curvaC(c-1,t,x,y);
linea(\'O\',t,x,y);
curvaD(c-1,t,x,y);}}
void curvaD (int c,int t,int*x,int*y){
if (c>0){curvaA(c-1,t,x,y);
linea(\'S\',t,x,y);
curvaD(c-1,t,x,y);
linea(\'E\',t,x,y);
curvaD(c-1,t,x,y);
linea(\'N\',t,x,y);
curvaC(c-1,t,x,y);}}
void linea (char dir, int t, int *x, int *y)
{switch (dir){
case \'N\':line(*x,*y,*x,*y-t);
*y=*y-t;
break;
case \'S\':line(*x,*y,*x,*y+t);
*y=*y+t;
break;
case \'E\':line(*x,*y,*x+t,*y);
*x=*x+t;
break;
case \'O\':line(*x,*y,*x-t,*y);
*x=*x-t;
break;
}}
void inicio ()
{
char t;
signed int i,j,k,l;
do{
printf(\"Que tipo de curva quieres? (A/B/C/D)\\n\");
t=toupper(getche());
if(t!=\'A\'&&t!=\'B\'&&t!=\'C\'&&t!=\'D\')printf(\"\\nOpcion no valida\\n\");
}while(t!=\'A\'&&t!=\'B\'&&t!=\'C\'&&t!=\'D\');
do{
printf(\"\\nQue orden de curva quieres? (menor a 21)\\n\");
scanf(\"%d\",&i);
if(i>21) printf(\"Opcion no valida\\n\");}while(i>21);
do{
printf(\"Que tamano de curva quieres? (menor a 19)\\n\");
scanf(\"%d\",&j);
if(j>19) printf(\"Opcion no valida\\n\");}while(j>19);
do{
printf(\"Dame el punto inicial x, menor a %d\\n\",getmaxx()/2);
scanf(\"%d\",&k);
if(k>(getmaxx()/2)) printf(\"Opcion no valida\\n\");
}while(k>(getmaxx()/2));
do{
printf(\"Dame el punto inicial y, menor a %d\\n\",getmaxy()/2);
scanf(\"%d\",&l);
if(l>(getmaxy()/2)) printf(\"Opcion no valida\\n\");
}while(l>(getmaxy()/2));
switch (t){
case \'A\':curvaA(i,j,&k,&l);break;
case \'B\':curvaB(i,j,&k,&l);break;
case \'C\':curvaC(i,j,&k,&l);break;
case \'D\':curvaD(i,j,&k,&l);break;
}
getch();
}