Backup proyecto Joyfe - Borland
This commit is contained in:
102
CPP/TEMP.CPP
Normal file
102
CPP/TEMP.CPP
Normal file
@ -0,0 +1,102 @@
|
||||
// Prog7
|
||||
//
|
||||
// Programadores:
|
||||
//
|
||||
// Juan L<>pez Fern<72>ndez
|
||||
// Mois<69>s Virumbrales Cuenca
|
||||
// DAI 1<>A
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
|
||||
char direccion;
|
||||
char caracter;
|
||||
int pos_x,pos_y,avanza,con,veces;
|
||||
|
||||
void main()
|
||||
{
|
||||
clrscr();
|
||||
gotoxy (20,11);
|
||||
printf ("Introduzca el car<61>cter a imprimir: ");
|
||||
fflush (stdin);
|
||||
cscanf ("%c", &caracter);
|
||||
//gotoxy (20,12);
|
||||
//printf ("Introduzca el sentido inicial: ");
|
||||
//fflush(stdin);
|
||||
//scanf("%c",&direccion_inicial);
|
||||
clrscr();
|
||||
direccion='e';
|
||||
pos_x=40;
|
||||
pos_y=12;
|
||||
avanza=1;
|
||||
gotoxy (pos_x,pos_y);
|
||||
printf ("%c",caracter);
|
||||
textcolor(14);
|
||||
do
|
||||
{
|
||||
for (con=1;con<=2;con++)
|
||||
{
|
||||
for (veces=1;direccion=='e' && veces<=avanza;veces++)
|
||||
{
|
||||
gotoxy(pos_x,pos_y);
|
||||
textcolor(2);
|
||||
cprintf("%c",caracter);
|
||||
pos_x++;
|
||||
}
|
||||
for (veces=1;direccion=='o' && veces<=avanza;veces++)
|
||||
{
|
||||
gotoxy(pos_x,pos_y);
|
||||
textcolor(14);
|
||||
cprintf("%c",caracter);
|
||||
pos_x--;
|
||||
}
|
||||
for (veces=1;direccion=='n' && veces<=avanza;veces++)
|
||||
{
|
||||
gotoxy(pos_x,pos_y);
|
||||
textcolor(13);
|
||||
cprintf("%c",caracter);
|
||||
pos_y--;
|
||||
}
|
||||
for (veces=1;direccion=='s' && veces<=avanza;veces++)
|
||||
{
|
||||
gotoxy(pos_x,pos_y);
|
||||
textcolor(12);
|
||||
cprintf("%c",caracter);
|
||||
pos_y++;
|
||||
}
|
||||
getch();
|
||||
// Cambio de direcciones.
|
||||
if (direccion=='e')
|
||||
{
|
||||
direccion='s';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (direccion=='o')
|
||||
{
|
||||
direccion='n';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (direccion=='n')
|
||||
{
|
||||
direccion='e';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (direccion=='s')
|
||||
{
|
||||
direccion='o';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
avanza++;
|
||||
}
|
||||
while (pos_y>0);
|
||||
gotoxy(80,25);
|
||||
getch();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user