Título: Ayudas o sugerencias - programa signo zodiaco
Publicado por: NetStorm en 16 Mayo 2009, 04:01 am
Hola chicos he empezado a estudiar VB.NET, y resulta que termine los ejercicios de la clase entonces el profesor con cara de condenado me dijo: "Quiero que hagas un programa que muestre el horoscopo de una persona ingresando solo el dia y mes de nacimiento, aclaro que esto lo haciendo en aplicaciones para consola este es mi avance trate de hacerlo con IF, pero cuando mire el detalle d la fecha de nacimiento ... OH DIOS!!!, necesito sugerencias o como podría hacerlo, haber echenme una manito, porque recien inicio en esto Imports System.Console 'PROGRAMA QUE MUESTRA EL SIGNO ZODIACAL DEL USUARIO CON EL DIA Y AÑO DE NACIMIENTO Module Module12 Sub main() Const ener As String = "Enero" Const febre As String = "Febrero" Const mar As String = "Marzo" Const abr As String = "Abril" Const mayo As String = "Mayo" Const jun As String = "Junio" Const jul As String = "Julio" Const agost As String = "Agosto" Const septi As String = "Septiembre" Const octub As String = "Octubre" Const novi As String = "Noviembre" Const dici As String = "Diciembre"
Dim mes As String Dim dia As Integer
WriteLine("Por favor, ingrese el mes de nacimiento") mes = ReadLine() WriteLine("Por favor, ingrese el día de nacimiento") dia = ReadLine() If mes = ener And dia < 20 < 18 Then
End If End Sub End Module ... Agradecido desde ya. Salu2 para todos.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 16 Mayo 2009, 04:16 am
Aver si te sirve este code creado por (¯`·.¸º|- POLIFORMIC -|º¸.·´¯)/*ingrese dia y mes de nacimiento, luego se debe determinar su signo sodiacal*/ #include<iostream.h> #include<conio.h> int dia, mes; void main(){ cout<<" TU SIGNO ZODIACAL "; cout<<"\n\r ---------------"; cout<<"\n\r Ingrese el Dia y mes de nacimiento "; cin>>dia>>mes; switch(mes){ case 1: if(dia<21) cout<<"CAPRICORNIO"; else cout<<"ACUARIO"; break; case 2: if(dia<20) cout<<"ACUARIO"; else cout<<"PICIS"; break; case 3: if(dia<21) cout<<"PICIS"; else cout<<"ARIES"; break; case 4: if(dia<21) cout<<"ARIES"; else cout<<"TAURO"; break; case 5: if(dia<21) cout<<"TAURO"; else cout<<"GEMINIS"; break; case 6: if(dia<22) cout<<"GEMINIS"; else cout<<"CANCER"; break; case 7: if(dia<23) cout<<"CANCER"; else cout<<"LEO"; break; case 8: if(dia<23) cout<<"LEO"; else cout<<"VIRGO"; break; case 9: if(dia<23) cout<<"VIRGO"; else cout<<"LIBRA"; break; case 10: if(dia<23) cout<<"LIBRA"; else cout<<"ESCORPIO"; break; case 11: if(dia<22) cout<<"ESCORPIO"; else cout<<"SAGITARIO"; break; case 12: if(dia<22) cout<<"SAGITARIO"; else cout<<"CAPRICORNIO"; break; default:cout<<"\n\r Mes y Dia son incorrectos"; } getch(); }
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Shell Root en 16 Mayo 2009, 07:00 am
Servira de Guia, porque eso no es VB... xD
Saludos!!!
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 16 Mayo 2009, 19:16 pm
int dia, mes; == Dim dia as integer Dim mes as integer switch(mes)== Select case mes
cout<<"\n\r Ingrese el Dia y mes de nacimiento "; cin>>dia>>mes; == Inputbox
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Jorgitoh en 17 Mayo 2009, 04:18 am
Hola buenas noches. Como primer instancia tienes que hacer el ingreso de datos que sino me equivoco el tuyo esta mas que bien:
Dim mes As String Dim dia As Integer
WriteLine("Por favor, ingrese el mes de nacimiento") mes = ReadLine() WriteLine("Por favor, ingrese el día de nacimiento") dia = ReadLine()
Al menos en C# ( desconozco VB pero debe ser lo mismo ) puedes pedir directamente la fecha con cierto formato y trabajar con el tipo de dato DateTime, pero de todos modos eso es solo un detalle que no afectaria el funcionamiento del programa.
Como segundo paso debes hacer un switch tal cual esta explicado en el ejemplo que te pusieron mas arriba. Seguramente conoces las estructuras de VB por lo cual lo unico que tienes que hacer es convertir ese codigo de C a VB. El cual su sintaxis no seria nada mas complicado que:
Switch ( mes ) Case ( 1 - 12 ) If Else
Lo que hace este switch es simple. Primero realiza un case para cada mes del año y luego "segmenta" por asi decirlo los dias con el If. Dejando dentro del If los dias que son menores a 20 / 21 / 22 / 23 ( dependiendo del mes ) al cual se le asigna el signo correspondiente al mes, y luego en el Else toma los dias restantes, asignandole el signo siguiente.
Depende de ti asignar ese signo a una variable o imprimirlo directamente en Consola.
Creo que el ejemplo esta mas que explicado. Solo te faltaria a vos realizar el Switch con la sintaxis de VB, que sino me equivoco en VB se lo conoce como "Select Case".
Saludos.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 17 Mayo 2009, 17:53 pm
Espero que te sirve lo hice a las apuradas en 5 minDim dia As Integer Dim mes As Integer Dim reponse As Boolean Private Sub Form_Load() dia = InputBox("Ingrese dia", "Signos") mes = InputBox("Ingrese mes", "Signos") Select Case mes Case 1 If dia < 21 Then reponse = MsgBox("CAPRICORNIO", vbOKOnly) Else: reponse = MsgBox("ACUARIO", vbOKOnly) End If Case 2 If dia < 20 Then reponse = MsgBox("ACUARIO", vbOKOnly) Else: reponse = MsgBox("PISCIS", vbOKOnly) End If Case 3 If dia < 21 Then reponse = MsgBox("PISCIS", vbOKOnly) Else: reponse = MsgBox("ARIES", vbOKOnly) End If Case 4 If dia < 21 Then reponse = MsgBox("ARIES", vbOKOnly) Else: reponse = MsgBox("TAURO", vbOKOnly) End If Case 5 If dia < 21 Then reponse = MsgBox("TAURO", vbOKOnly) Else: reponse = MsgBox("GEMINIS", vbOKOnly) End If Case 6 If dia < 22 Then reponse = MsgBox("GEMINIS", vbOKOnly) Else: reponse = MsgBox("CANCER", vbOKOnly) End If Case 7 If dia < 23 Then reponse = MsgBox("CANCER", vbOKOnly) Else: reponse = MsgBox("LEO", vbOKOnly) End If Case 8 If dia < 23 Then reponse = MsgBox("LEO", vbOKOnly) Else: reponse = MsgBox("VIRGO", vbOKOnly) End If Case 9 If dia < 23 Then reponse = MsgBox("VIRGO", vbOKOnly) Else: reponse = MsgBox("LIBRA", vbOKOnly) End If Case 10 If dia < 23 Then reponse = MsgBox("LIBRA", vbOKOnly) Else: reponse = MsgBox("ESCORPIO", vbOKOnly) End If Case 11 If dia < 22 Then reponse = MsgBox("ESCORPIO", vbOKOnly) Else: reponse = MsgBox("SAGITARIO", vbOKOnly) End If Case 12 If dia < 22 Then reponse = MsgBox("SAGITARIO", vbOKOnly) Else: reponse = MsgBox("CAPRICORNIO", vbOKOnly) End If Case Else reponse = MsgBox("Error") End Select End Sub
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: NetStorm en 17 Mayo 2009, 23:35 pm
Waooo, agradezco la última respuesta no tengo conocimiento de "case", pero ahora que veo la estructura aprendo más ... tio sos un grande, sabes la misma noche que escribi mi duda diseñe este algoritmo pero no sé porque no funciona alguien me da el "Hey!!!, fallaste en esto" ??? ... aqui les dejo el code aunque esta larguísimo. Imports System.Console
Module Module1
Sub Main() Const january As String = "enero" Const febrary As String = "febrero" Const march As String = "marzo" Const april As String = "abril" Const may As String = "mayo" Const june As String = "junio" Const july As String = "julio" Const agost As String = "agosto" Const september As String = "setiembre" Const october As String = "octubre" Const november As String = "noviembre" Const december As String = "diciembre" Const horoaries As String = "Hoy te ira bien aries" Const horotauro As String = "hoy te ira bien tauro" Const horogeminis As String = "Hoy te ira bien geminis" Const horocancer As String = "Hoy te ira bien cancer" Const horoleo As String = "Hoy te ira bien leo" Const horovirgo As String = "Hoy te ira bien virgo" Const horolibra As String = "Hoy te ira bien libra" Const horoescorpio As String = "Hoy te ira bien horoescorpio" Const horosagitario As String = "Hoy te ira bien sagitario" Const horocapricornio As String = "Hoy te ira bien capricornio" Const horoacuario As String = "Hoy te ira bien acuario" Const horopiscis As String = "Hoy te ira bien piscis"
Dim mes As String Dim dia As Integer
WriteLine("por favor ingrese el mes de nacimiento") mes = ReadLine() WriteLine("Ingrese su dia de nacimiento") dia = ReadLine()
If mes = january And dia > 0 < 20 Then WriteLine(horocapricornio & " mucha suerte") ReadLine() Else If mes = january And dia > 19 < 32 Then WriteLine(horoacuario & " mucha suerte") ReadLine() Else If mes = febrary And dia > 0 < 19 Then WriteLine(horoacuario & " mucha suerte") ReadLine() Else If mes = febrary And dia > 18 < 30 Then WriteLine(horopiscis & " mucha suerte") ReadLine() Else If mes = march And dia > 0 < 20 Then WriteLine(horopiscis & " mucha suerte") ReadLine() Else If mes = march And dia > 18 < 32 Then WriteLine(horoaries & " mucha suerte") ReadLine() Else If mes = april And dia > 0 < 19 Then WriteLine(horoaries & " mucha suerte") ReadLine() Else If mes = april And dia >= 19 < 32 Then WriteLine(horotauro & " mucha suerte") ReadLine() Else If mes = may And dia >= 1 < 20 Then WriteLine(horotauro & " mucha suerte") ReadLine() Else If mes = may And dia >= 20 < 32 Then WriteLine(horogeminis & " mucha suerte") ReadLine() Else If mes = june And dia >= 1 < 21 Then WriteLine(horogeminis & " mucha suerte") ReadLine() Else If mes = june And dia >= 21 < 32 Then WriteLine(horocancer & " mucha suerte") ReadLine() Else If mes = july And dia >= 1 < 22 Then WriteLine(horocancer & " mucha suerte") ReadLine() Else If mes = july And dia >= 22 < 32 Then WriteLine(horoleo & " mucha suerte") ReadLine() Else If mes = agost And dia >= 1 < 22 Then WriteLine(horoleo & " mucha suerte") ReadLine() Else If mes = agost And dia >= 22 < 32 Then WriteLine(horovirgo & " mucha suerte") ReadLine() Else If mes = september And dia >= 1 < 22 Then WriteLine(horovirgo & " mucha suerte") ReadLine() Else If mes = september And dia >= 22 < 32 Then WriteLine(horolibra & " mucha suerte") ReadLine() Else If mes = october And dia >= 1 < 23 Then WriteLine(horolibra & " mucha suerte") ReadLine() Else If mes = october And dia >= 23 < 32 Then WriteLine(horoescorpio & " mucha suerte") ReadLine() Else If mes = november And dia >= 1 < 21 Then WriteLine(horoescorpio & " mucha suerte") ReadLine() Else If mes = november And dia >= 21 < 32 Then WriteLine(horosagitario & " mucha suerte") ReadLine() Else If mes = december And dia >= 1 < 21 Then WriteLine(horosagitario & " mucha suerte") ReadLine() Else If mes = december And dia >= 21 < 32 Then WriteLine(horocapricornio & " mucha suerte") ReadLine() Else WriteLine("Los datos ingresados no son correctos, deja de bromear conmigo que no tengo todo el dia ¿vale?") ReadLine() End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If
End Sub
End Module
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 17 Mayo 2009, 23:44 pm
Al tratar de compilarlo te larga error?... Antes de ponerme a leer todos esos if's anidados te agradeceria que pongas el error al compilar.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: NetStorm en 17 Mayo 2009, 23:52 pm
No ningun error ... solo que no funciona ... le pongo por ejemplo agosto 30 y me dice que soy LEO ... !!!! diablos... que pasa? :o
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 18 Mayo 2009, 01:08 am
Dim dia As String Dim mes As String Dim reponse As Boolean Private Sub Form_Load() dia = InputBox("Ingrese dia", "Signos") If dia = "" Then End End If While (dia < 1) Or (dia > 31) Or (dia = "") MsgBox "Error, los meses solo contienen dias entre 1 y 31", vbOKOnly dia = InputBox("Ingrese dia", "Signos") Wend dia = Val(dia) mes = InputBox("Ingrese mes", "Signos") Select Case mes Case "enero" If dia < 21 Then MsgBox "CAPRICORNIO", vbOKOnly Else: MsgBox "ACUARIO", vbOKOnly End If Case "febrero" If dia < 20 Then MsgBox "ACUARIO", vbOKOnly Else: MsgBox "PISCIS", vbOKOnly End If Case "marzo" If dia < 21 Then MsgBox "PISCIS", vbOKOnly Else: MsgBox "ARIES", vbOKOnly End If Case "abril" If dia < 21 Then MsgBox "ARIES", vbOKOnly Else: MsgBox "TAURO", vbOKOnly End If Case "mayo" If dia < 21 Then MsgBox "TAURO", vbOKOnly Else: MsgBox "GEMINIS", vbOKOnly End If Case "junio" If dia < 22 Then MsgBox "GEMINIS", vbOKOnly Else: MsgBox "CANCER", vbOKOnly End If Case "julio" If dia < 23 Then MsgBox "CANCER", vbOKOnly Else: MsgBox "LEO", vbOKOnly End If Case "agosto" If dia < 23 Then MsgBox "LEO", vbOKOnly Else: MsgBox "VIRGO", vbOKOnly End If Case "setiembre" If dia < 23 Then MsgBox "VIRGO", vbOKOnly Else: MsgBox "LIBRA", vbOKOnly End If Case "octubre" If dia < 23 Then MsgBox "LIBRA", vbOKOnly Else: MsgBox "ESCORPIO", vbOKOnly End If Case "noviembre" If dia < 22 Then MsgBox "ESCORPIO", vbOKOnly Else: MsgBox "SAGITARIO", vbOKOnly End If Case "diciembre" If dia < 22 Then MsgBox "SAGITARIO", vbOKOnly Else: MsgBox "CAPRICORNIO", vbOKOnly End If Case Else MsgBox "Error", vbOKOnly End Select End Sub
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 18 Mayo 2009, 01:49 am
Ahora arreglado el tema de la entrada con mayuscula o minuscula... Usando Ucase() Solo falta depurar un poco más los signos, pero creo que ya esta bien. Dim dia As String Dim mes As String Dim reponse As Boolean Private Sub Form_Load() dia = InputBox("Ingrese dia", "Signos") If dia = "" Then End End If While (dia < 1) Or (dia > 31) Or (dia = "") MsgBox "Error, los meses solo contienen dias entre 1 y 31", vbOKOnly dia = InputBox("Ingrese dia", "Signos") Wend dia = Val(dia) mes = InputBox("Ingrese mes", "Signos") mes = UCase(mes) Select Case mes Case "ENERO" If dia < 21 Then MsgBox "CAPRICORNIO", vbOKOnly Else: MsgBox "ACUARIO", vbOKOnly End If Case "FEBRERO" If dia < 20 Then MsgBox "ACUARIO", vbOKOnly Else: MsgBox "PISCIS", vbOKOnly End If Case "MARZO" If dia < 21 Then MsgBox "PISCIS", vbOKOnly Else: MsgBox "ARIES", vbOKOnly End If Case "ABRIL" If dia < 21 Then MsgBox "ARIES", vbOKOnly Else: MsgBox "TAURO", vbOKOnly End If Case "MAYO" If dia < 21 Then MsgBox "TAURO", vbOKOnly Else: MsgBox "GEMINIS", vbOKOnly End If Case "JUNIO" If dia < 21 Then MsgBox "GEMINIS", vbOKOnly Else: MsgBox "CANCER", vbOKOnly End If Case "JULIO" If dia < 24 Then MsgBox "CANCER", vbOKOnly Else: MsgBox "LEO", vbOKOnly End If Case "AGOSTO" If dia < 24 Then MsgBox "LEO", vbOKOnly Else: MsgBox "VIRGO", vbOKOnly End If Case "SETIEMBRE" If dia < 24 Then MsgBox "VIRGO", vbOKOnly Else: MsgBox "LIBRA", vbOKOnly End If Case "OCTUBRE" If dia < 24 Then MsgBox "LIBRA", vbOKOnly Else: MsgBox "ESCORPIO", vbOKOnly End If Case "NOVIEMBRE" If dia < 22 Then MsgBox "ESCORPIO", vbOKOnly Else: MsgBox "SAGITARIO", vbOKOnly End If Case "DICIEMBRE" If dia < 22 Then MsgBox "SAGITARIO", vbOKOnly Else: MsgBox "CAPRICORNIO", vbOKOnly End If Case Else MsgBox "Error", vbOKOnly End Select End End Sub
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Jorgitoh en 18 Mayo 2009, 13:26 pm
Tene en cuenta que estas usando Windows Forms y el user solo esta manejando la Consola. De todos modos la sintaxis esta bien, solo habria que cambiar los Input Box por ReadLine y los Message por WriteLine.
Saludos.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 18 Mayo 2009, 16:00 pm
Si :xD anoche estuve hablando con el y aclarando un par de dudas que tenia. El problema creo que se ha solucionado.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: NetStorm en 18 Mayo 2009, 17:54 pm
Gracias ha sido un trabajo exitoso, lo habeís hecho excelente agradecer profundamente a m@deb su ánimo desinteresado por su ayuda de forma "integra" y no mediocre, paso cerca de 3 horas explicándome muchas cosas que ahora tengo claras aunque en clases ni las he tocado (por ejem. los forms), y nada agradecer a todos los integrantes del foro que también aportaron lo suyo ...
Finalmente quiero solicitarle al mod del foro que de por cerrado el tema, ya que se ha solucionado el problema.
Gracias, sinceramente sos grandes como dice m@deb... vale Che'
Salu2 desde Arequipa - Perú.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: Myth.ck en 18 Mayo 2009, 18:11 pm
Pues de nada. Cuando uno ayuda, tambien aprende muchas cosas, ya que no soy un Gurú de la programación. Sin mas que decir.
Salu2!
Título: SOLUCIÓN !!!
Publicado por: NetStorm en 3 Junio 2009, 03:44 am
Bien para los interesados aquí está el código, como todavía veo que la prgunta está abierta, entonces posteo el código, OJO que esto es en modo consola, M@deb lo realizó en form, pero yo lo adapté a consola. En fin... Imports system.console
Module module1 Sub main()
Dim dia As Integer Dim mes As String Dim feberror As Integer = 29
Const horoaries As String = "hoy tendrás un gran día" Const horotauro As String = "hoy tendrás un gran día" Const horogeminis As String = "hoy tendrás un gran día" Const horocancer As String = "hoy tendrás un gran día" Const horoleo As String = "hoy tendrás un gran día" Const horovirgo As String = "hoy tendrás un gran día" Const horolibra As String = "hoy tendrás un gran día" Const horoescorpio As String = "hoy tendrás un gran día" Const horosagitario As String = "hoy tendrás un gran día" Const horocapricornio As String = "hoy tendrás un gran día" Const horoacuario As String = "hoy tendrás un gran día" Const horopiscis As String = "hoy tendrás un gran día"
Writeline("Por favor, ingrese el dia de nacimiento") Dia = readline() If dia = (dia < 1) Or (dia > 31) Then WriteLine("Error, los meses solo contienen dias entre 1 y 31") ReadLine() Else WriteLine("Ahora ingrese el mes de nacimiento") mes = ReadLine() If mes = ("febrero") And (dia > 29) Then WriteLine("Oh, Oh!!!, febrero no tiene " & dia & " días, se le asignará 29 como valor") ReadLine() dia = 29 Else End If mes = UCase(mes) Select Case mes Case "ENERO" If dia < 21 Then WriteLine("CAPRICORNIO " & horocapricornio) ReadLine() Else : WriteLine("ACUARIO " & horoacuario) ReadLine() End If Case "FEBRERO" If dia < 20 Then WriteLine("ACUARIO " & horoacuario) ReadLine() Else : WriteLine("PISCIS " & horopiscis) ReadLine() End If Case "MARZO" If dia < 21 Then WriteLine("PISCIS " & horopiscis) ReadLine() Else : WriteLine("ARIES " & horoaries) ReadLine() End If Case "ABRIL" If dia < 21 Then WriteLine("ARIES " & horoaries) ReadLine() Else : WriteLine("TAURO " & horotauro) ReadLine() End If Case "MAYO" If dia < 21 Then WriteLine("TAURO " & horotauro) ReadLine() Else : WriteLine("GEMINIS " & horogeminis) ReadLine() End If Case "JUNIO" If dia < 21 Then WriteLine("GEMINIS " & horogeminis) ReadLine() Else : WriteLine("CANCER " & horocancer) ReadLine() End If Case "JULIO" If dia < 24 Then WriteLine("CANCER " & horocancer) ReadLine() Else : WriteLine("LEO " & horoleo) ReadLine() End If Case "AGOSTO" If dia < 24 Then WriteLine("LEO " & horoleo) ReadLine() Else : WriteLine("VIRGO " & horovirgo) ReadLine() End If Case "SETIEMBRE" If dia < 24 Then WriteLine("VIRGO " & horovirgo) ReadLine() Else : WriteLine("LIBRA " & horolibra) ReadLine() End If Case "OCTUBRE" If dia < 24 Then WriteLine("LIBRA " & horolibra) ReadLine() Else : WriteLine("ESCORPIO " & horoescorpio) ReadLine() End If Case "NOVIEMBRE" If dia < 22 Then WriteLine("ESCORPIO " & horoescorpio) ReadLine() Else : WriteLine("SAGITARIO " & horosagitario) ReadLine() End If Case "DICIEMBRE" If dia < 22 Then WriteLine("SAGITARIO " & horosagitario) ReadLine() Else : WriteLine("CAPRICORNIO " & horocapricornio) ReadLine() End If Case Else Write("Oh, oh!!!, ... Ha ocurrido un error los datos ingresados no son válidos") ReadLine() End Select End If End Sub End Module
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: h0oke en 3 Junio 2009, 03:52 am
Const horoaries As String = "hoy tendrás un gran día" Const horotauro As String = "hoy tendrás un gran día" Const horogeminis As String = "hoy tendrás un gran día" Const horocancer As String = "hoy tendrás un gran día" Const horoleo As String = "hoy tendrás un gran día" Const horovirgo As String = "hoy tendrás un gran día" Const horolibra As String = "hoy tendrás un gran día" Const horoescorpio As String = "hoy tendrás un gran día" Const horosagitario As String = "hoy tendrás un gran día" Const horocapricornio As String = "hoy tendrás un gran día" Const horoacuario As String = "hoy tendrás un gran día" Const horopiscis As String = "hoy tendrás un gran día"
Una pregunta.. ¿Por qué declaras tantas veces lo mismo? No daría igual que uses: Const Horoscopo As String= "Hoy tendrás un gran dia"
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: NetStorm en 6 Junio 2009, 18:26 pm
Cierto ... tu lógica es aplastante, pero sabes, yo consideré la oportunidad de decirle a cada signo una cosa distinta, y como ves no soy bueno con eso de los horóscopos, imagina que en tu variable coloques "Hoy te amputaran la pierna", ¿a todos los signos les dirás lo mismo?, solo era cuestión de modificar el texto a distintas predicciones para cada signo, eso fue lo que yo consideré, pero como digo ... no soy bueno en eso, será que jamás creo en la suerte. ;D
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: h0oke en 6 Junio 2009, 18:38 pm
:D Entonces... no dije nada... ::) Es verdad lo que dices, pero yo pensé que habias presentado de esa manera el programa.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: seba123neo en 7 Junio 2009, 00:44 am
Hola, mira este codigo yo lo habia realizado cuando tuve que hacer algo parecido...es una funcion que se encarga de calcular el signo...y te ahorras todos esos SELECT CASE que no me gustan cuando son muchos... Imports system.console Module module1 Private Enum MESES ENERO = 1 FEBRERO = 2 MARZO = 3 ABRIL = 4 MAYO = 5 JUNIO = 6 JULIO = 7 AGOSTO = 8 SEPTIEMBRE = 9 OCTUBRE = 10 NOVIEMBRE = 11 DICIEMBRE = 12 End Enum Const horoaries As String = "hoy tendrás un gran día" Const horotauro As String = "hoy tendrás un gran día" Const horogeminis As String = "hoy tendrás un gran día" Const horocancer As String = "hoy tendrás un gran día" Const horoleo As String = "hoy tendrás un gran día" Const horovirgo As String = "hoy tendrás un gran día" Const horolibra As String = "hoy tendrás un gran día" Const horoescorpio As String = "hoy tendrás un gran día" Const horosagitario As String = "hoy tendrás un gran día" Const horocapricornio As String = "hoy tendrás un gran día" Const horoacuario As String = "hoy tendrás un gran día" Const horopiscis As String = "hoy tendrás un gran día" Sub main() Dim dia As Integer Dim mes As String Dim feberror As Integer = 29 Dim vMes As MESES WriteLine("Por favor, ingrese el dia de nacimiento") dia = ReadLine() If dia = (dia < 1) Or (dia > 31) Then WriteLine("Error, los meses solo contienen dias entre 1 y 31") ReadLine() Else WriteLine("Ahora ingrese el mes de nacimiento") mes = ReadLine() If mes = ("febrero") And (dia > 29) Then WriteLine("Oh, Oh!!!, febrero no tiene " & dia & " días, se le asignará 29 como valor") ReadLine() dia = 29 Else End If mes = UCase(mes) Dim a() As String = System.Enum.GetNames(vMes.GetType) Dim vIndiceMes As Integer For i As Integer = 0 To a.Length - 1 If mes = a.GetValue(i) Then vIndiceMes = i + 1 WriteLine(Zodiaco(vIndiceMes & dia)) ReadLine() Exit Sub End If Next WriteLine("Oh, oh!!!, ... Ha ocurrido un error los datos ingresados no son válidos") ReadLine() End If End Sub Private Function Zodiaco(ByVal Fecha As Integer) As String If Fecha <= 219 And Fecha >= 121 Then Zodiaco = "ACURARIO " & horoacuario ElseIf Fecha <= 320 And Fecha >= 220 Then Zodiaco = "PISCIS " & horopiscis ElseIf Fecha <= 420 And Fecha >= 321 Then Zodiaco = "ARIES " & horoaries ElseIf Fecha <= 521 And Fecha >= 421 Then Zodiaco = "TAURO " & horotauro ElseIf Fecha <= 621 And Fecha >= 522 Then Zodiaco = "GEMINIS " & horogeminis ElseIf Fecha <= 722 And Fecha >= 622 Then Zodiaco = "CANCER " & horocancer ElseIf Fecha <= 822 And Fecha >= 723 Then Zodiaco = "LEO " & horoleo ElseIf Fecha <= 923 And Fecha >= 823 Then Zodiaco = "VIRGO " & horovirgo ElseIf Fecha <= 1023 And Fecha >= 924 Then Zodiaco = "LIBRA " & horolibra ElseIf Fecha <= 1122 And Fecha >= 1024 Then Zodiaco = "ESCORPIO " & horoescorpio ElseIf Fecha <= 1221 And Fecha >= 1123 Then Zodiaco = "SAGITARIO " & horosagitario Else Zodiaco = "CAPRICORNIO " & horocapricornio End If End Function End Module
saludos.
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: cobolitros en 4 Mayo 2011, 14:27 pm
Disculpen pero como se podria obtener el Signo zodiacal pero con vectores
Título: Re: Ayudas o sugerencias - programa signo zodiaco
Publicado por: cocori002 en 16 Noviembre 2013, 00:23 am
Hola, ¿alguien sabe como hacer un script de linux que te pida día y mes y te diga el signo del zodiaco? yo lo he intentado con todo y no me sale de ninguna manera...
Saludos.
|