Files
Borland-C/CPP/PROG8.CPP

63 lines
969 B
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Prog8
//
// Programadores:
//
// Juan L¢pez Fern ndez
// Moiss Virumbrales Cuenca
// DAI 1§A
//
#include <stdio.h>
#include <conio.h>
char direccion;
char caracter;
int pos_x,pos_y,con;
void main()
{
clrscr();
gotoxy (20,11);
printf ("Introduzca el car cter a imprimir: ");
fflush (stdin);
cscanf ("%c", &caracter);
clrscr();
direccion='d';
pos_x=1;
pos_y=1;
for (;pos_y<=24;pos_y++)
{
for (con=1;con<=80;con++)
{
if (direccion=='d')
{
gotoxy(pos_x,pos_y);
printf ("%c",caracter);
pos_x++;
}
else
{
gotoxy(pos_x,pos_y);
printf ("%c",caracter);
pos_x--;
}
if (con==40)
{
getch();
}
}
getch();
if (direccion=='d')
{
direccion='i';
pos_x--;
}
else
{
direccion='d';
pos_x++;
}
}
gotoxy(1,25);
printf ("Pulse una tecla para finalizar...");
getch();
}