El siguiente programa en C nos pide que creemos una pirámide similar a la del juego Mario Bros con caracteres #,
para esto utilizamos varios bucles for anidados, el código no es extenso mas la lógica para obtener el patrón es un poco intrincada, es un pset(1) de Edx,
estas son las instrucciones:
Escribe, en un archivo llamado mario.c , un programa que recrea esta media pirámide utilizando hashes (#) para los bloques. Sin embargo, para hacer las cosas más interesantes, en primer lugar solicitar al usuario la altura de la media-pirámide, un entero no negativo no mayor que 23. Si el usuario no proporciona un número entero no negativo no mayor que 23, debe volver a solicitud para el mismo otra vez. Entonces, generar (con la ayuda de printf y uno o más bucles) la media-pirámide deseada. Tenga cuidado de alinear la esquina inferior izquierda de su medio-pirámide con el borde izquierdo de la ventana de terminal.
Okey esto es lo solicitado veamos lo que nos arroja el sgte.
código.
mario2.c
#include <stdio.h>
int main (void)
{
int contadorA; //contador de lineas
int contadorB; //contador de hashes #
int contadorC; //contador de espacios =num total de lineas - 2
int n;
{
do
{
printf("Ingrese la Altura de la Piramide: ");
scanf("%d", &n);
}
while (n>23 || n<=0);
}
for(contadorA= 1; contadorA <= n-1; contadorA ++ )
{
{
for ( contadorC = n-2 ; contadorC >= contadorA ; contadorC-- )
printf(" ");
}
{
for (contadorB = 0 ; contadorB <= contadorA ; contadorB++)
printf("#"); // imprime hash
}
printf ("\n"); //imprime espacio
}
} // fin de main
Comentarios, sugerencias, amistad :
unforgiven252525@gmail.com
Write, in a file called mario.c a program that recreates this half-pyramid using hashes (#) for blocks. However, to make things more interesting, first prompt the user for the half-pyramid’s height, a non-negative integer no greater than 23. (The height of the half-pyramid pictured above happens to be 8.) If the user fails to provide a non-negative integer no greater than 23, you should re-prompt for the same again. Then, generate (with the help of printf and one or more loops) the desired half-pyramid. Take care to align the bottom-left corner of your half-pyramid with the left-hand edge of your terminal window.
sábado, 23 de noviembre de 2013
jueves, 7 de noviembre de 2013
These Days
Creo que las canciones hablan por si solas,
de la desesperanza y vació
que vivimos estos días.
everybody`s got their cross bare these days
she came looking for some shelter with a suitcase full of dreams
to a motel room on the boulevard
guess she's trying to be james dean
she's seen all the disciples and all the wannabes
no one wants to be themselves these days
still there's nothing to hold onto but these days
chorus: these days the stars seem out of reach
these days there ain't a ladder on the streets
these days are fast
love don't last in this graceless age
there ain't nobody left but us these days
jimmy shoes busted both his legs, trying to learn to fly
from a second story window
he just jumped and closed his eyes
his momma said he was crazy
he said, "momma, i've got to try"
don't you know that all my heroes died
and i guess i'd rather die than fade away
chorus: these days the stars seem out of reach
these days there ain't a ladder on the streets
these days are fast
love don't last in this graceless age
even innocence has caught the midnight train
and there ain't nobody left but us these days
i know rome's still burning though the times have changed
this world keeps turning round and round and round and round these days
solo
chorus: these days the stars seem out of reach
these days there ain't a ladder on the streets
these days are fast
nothing lasts in this graceless age
even innocence has caught the midnight train
and there ain't nobody left but us these days
These days the stars are out of reach
these days there ain't no ladder on the streets
these days are fast
nothing lasts, there ain't no time to waste
there ain't nobody left to take the blame
there ain't nobody left but us these days..
Estaba paseando, solo un rostro en la multitud
tratando de evitar la lluvia
vi a un rey vagabundo con una corona de corcho
me pregunté si yo podría acabar igual
Hay un hombre en la esquina cantando viejas canciones de cambios
todo el mundo tiene una cruz a sus espaldas con la que cargar estos días
Ella llegó buscando un refugio con una maleta llena de sueños
a la habitación de un motel del boulevard
Supongo que quiere ser como James Dean
Ha visto todos los discípulos y todos lo "quiero ser"
Nadie quiere ser uno mismo estos días
Aún así, no hay nada a lo que agarrarse, más que a estos días.
Estos días - las estrellas parecen inalcanzables
Estos días - no hay ninguna escalera en las calles
Estos días - son rápidos, el amor no dura en esta época de descortesía
No queda nadie excepto nosotros estos días
Jimmy Shoes se rompió las dos piernas intentando aprender a volar
desde la ventana de un segundo piso, saltó y cerró los ojos
Su madre le dijo que estaba loco - él dijo "mamá tengo que intentarlo"
¿Es que no sabes que todos mis héroes murieron?
Y supongo que prefiero morir a consumirme lentamente
Estos días - las estrellas parecen inalcanzables
Estos días - no hay ninguna escalera en las calles
Estos días - son rápidos, el amor no dura en esta época de descortesía
No queda nadie excepto nosotros estos días
Sé que Roma aún está en llamas
aunque los tiempos han cambiado
este mundo sigue girando, girando, girando y girando
Estos días
Estos días - las estrellas parecen inalcanzables
Estos días - no hay ninguna escalera en las calles
Estos días - son rápidos, el amor no dura en esta época de descortesía
No queda nadie excepto nosotros estos días
Estos días - las estrellas parecen inalcanzables
Estos días - no hay ninguna escalera en las calles
Estos días - son rápidos, el amor no dura en esta época de descortesía
No hay tiempo que perder
No queda nadie a quien culpar
No queda nadie excepto nosotros estos días
|
Call you up in the middle of the night
Like a firefly without a light
You were there like a slow torch burning
I was a key that could use a little turning
So tired that I couldn't even sleep
So many secrets I couldn't keep
Promised myself I wouldn't weep
One more promise I couldn't keep
It seems no one can help me now
I'm in too deep
There's no way out
This time I have really led myself astray
CHORUS
Runaway train never going back
Wrong way on a one way track
Seems like I should be getting somewhere
Somehow I'm neither here no there
Can you help me remember how to smile
Make it somehow all seem worthwhile
How on earth did I get so jaded
Life's mystery seems so faded
I can go where no one else can go
I know what no one else knows
Here I am just drownin' in the rain
With a ticket for a runaway train
Everything is cut and dry
Day and night, earth and sky
Somehow I just don't believe it
CHORUS
Bought a ticket for a runaway train
Like a madman laughin' at the rain
Little out of touch, little insane
Just easier than dealing with the pain
Runaway train never comin' back
Runaway train tearin' up the track
Runaway train burnin' in my veins
Runaway but it always seems the same
Like a firefly without a light
You were there like a slow torch burning
I was a key that could use a little turning
So tired that I couldn't even sleep
So many secrets I couldn't keep
Promised myself I wouldn't weep
One more promise I couldn't keep
It seems no one can help me now
I'm in too deep
There's no way out
This time I have really led myself astray
CHORUS
Runaway train never going back
Wrong way on a one way track
Seems like I should be getting somewhere
Somehow I'm neither here no there
Can you help me remember how to smile
Make it somehow all seem worthwhile
How on earth did I get so jaded
Life's mystery seems so faded
I can go where no one else can go
I know what no one else knows
Here I am just drownin' in the rain
With a ticket for a runaway train
Everything is cut and dry
Day and night, earth and sky
Somehow I just don't believe it
CHORUS
Bought a ticket for a runaway train
Like a madman laughin' at the rain
Little out of touch, little insane
Just easier than dealing with the pain
Runaway train never comin' back
Runaway train tearin' up the track
Runaway train burnin' in my veins
Runaway but it always seems the same
Te llamo en medio de la noche,
Como una luciérnaga sin luz,
Estabas ahí como un soplete quemándose,
Yo era un llave que necesitaba ser girada.
Estaba tan cansado que no podía ni dormir,
Había muchos secretos que no podía mantener,
Me prometí a mi mismo que no lloraría,
Era una promesa más que no podía cumplir.
Parece que nadie me puede ayudar ahora,
Estoy demasiado en lo profundo,
No hay salida.
Esta vez realmente me dejé vencer.
Tren fugitivo, nunca regresa,
Camino equivocado en una carretera de un solo sentido,
Parece que debería llegar a algún lado,
De alguna manera no estoy ni aquí ni allá.
Puedes ayudarme a recordar cómo sonreír?,
Haz algo para que parezca que todo tiene sentido,
Cómo llegué a estar tan saturado de la tierra?
El misterio de la vida parece disperso.
Pero yo puedo ir a donde nadie puede ir,
Yo sé lo que nadie sabe,
Aquí estoy ahogado en la lluvia,
Con un boleto para un tren fugitivo.
Y todo parece preciso,
Día y noche, tierra y cielo,
De alguna manera, simplemente no lo creo...
Tren fugitivo, nunca regresa,
Camino equivocado en una carretera de un solo sentido,
Parece que debería llegar a algún lado,
De alguna manera no estoy ni aquí ni allá.
Compré un boleto para un tren fugitivo,
Como un hombre que ríe bajo la lluvia,
Un poco loco, un poco insano,
Es más fácil que enfrentar el dolor.
Tren fugitivo, nunca regresa,
Camino equivocado en una carretera de un solo sentido,
Parece que debería llegar a algún lado,
De alguna manera no estoy ni aquí ni allá.
Tren fugitivo, nunca regresando,
Tren fugitivo, rasgando la vía,
Tren fugitivo, quemándose en mis venas,
Yo huyo pero siempre parece lo mismo...
El principio del fin princesa
Entre la cirrosis y la sobredosis
Andas siempre, muñeca.
Con tu sucia camisa
Y, en lugar de sonrisa,
Una especie de mueca.
¿cómo no imaginarte,
Cómo no recordarte
Hace apenas cuatro años?
Cuando eras la princesa
De la boca de fresa,
Cuando tenías aún esa forma
De hacerme daño.
Ahora es demasiado tarde, princesa.
Búscate otro perro que te ladre, princesa.
Maldito sea el gurú
Que levantó entre tú
Y yo un silencio oscuro,
Del que ya sólo sales
Para decirme, vale,
Déjame veinte duros.
Ya no te tengo miedo
Nena, pero no puedo
Seguirte en tu viaje.
Cúantas veces hubiera dado la vida entera
Porque tú me pidieras
Llevarte el equipaje.
Ahora es demasiado tarde, princesa...
Tú que sembraste en todas
Las islas de la moda
Las flores de tu gracia,
¿cómo no ibas a verte
Envuelta en una muerte
Con asalto a farmacia?
¿con qué ley condenarte
Si somos juez y parte
Todos de tus andanzas?
Sigue con tus movidas,
Pero no pidas
Que me pase la vida
Pagándote fianzas.
Ahora es demasiado tarde, princesa
Búscate otro perro que te ladre, princesa
Suscribirse a:
Entradas (Atom)