//Creación de un cubo en C++
#include<dos.h>
#include<iostream.h>
#include<conio.h>
void cubo(int a,int x, int y)
{
int y2=y+a;
int t=30;
for(int i=0; i<=a; i++)
{
delay(t);
gotoxy(x+i,y);
cout<<"*";
gotoxy(x+i,y2);
cout<<"*";
gotoxy(x+i+3,y+3);
cout<<"*";
gotoxy(x+3+i,y2+3);
cout<<"*";
}
for(int j=0; j<=a; j++)
{
delay(t);
gotoxy(x,y+j);
cout<<"*";
gotoxy(x+a,y+j);
cout<<"*";
gotoxy(x+3,y+3+j);
cout<<"*";
gotoxy(x+3+a,y+3+j);
cout<<"*";
}
for (int f=0;f<=3;f++)
{
delay(t);
gotoxy(x+f,y+f);
cout<<"*";
gotoxy(x+f+a,y+f);
cout<<"*";
gotoxy(x+f,y+f+a);
cout<<"*";
gotoxy(x+f+a,y+f+a);
cout<<"*";
}
}
void main()
{
clrscr();
int x,y,a;
cout<<"Ingrese la coordenada X : ";
cin>>x;
cout<<"\n\n Ingrese la coordenada Y : ";
cin>>y;
cout<<"\n\n Ingrese la arista : ";
cin>>a;
gotoxy(1,48);
cout<<"CUBO";
cubo(x,y,a);
getch();
}
No hay comentarios:
Publicar un comentario