jueves, 17 de septiembre de 2015

Congreso Sofware Libre 2015


Asistan!

viernes, 4 de septiembre de 2015

Beep musical en C#.

Para hacer, de vez en cuando la programación un poco más divertida en nuestros ejercicios de consola, podemos poner pequeñas melodías con el comando beep.

Aquí un pequeño ejemplo con un ciclo for en donde el método sobrecargado beep tiene como parámetros la frecuencia a reproducir y la duración en mili-segundos.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sonido_prueba
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int f = 37; f <= 3276; f+=200)
            {
                Console.Beep(f, 100);
                Console.WriteLine("Reproduciendo la frecuencia {0} 1000 ms.....",f);
            }
        }
    }
}

Nota: el proyecto es en consola.

#RT @rezzaca

martes, 1 de septiembre de 2015

Matrices de objetos.

Programar el siguiente ejemplo y realiza uno propio:

namespace CDCollection
{
    // Define a CD type.
    class CD
    {
        private string album;
        private string artist;
        private int rating;

        public string Album
        {
            get {return album;}
            set {album = value;} 
        }
        public string Artist
        {
            get {return artist;}
            set {artist = value;}
        }
        public int Rating
        { 
            get {return rating;} 
            set {rating = value;} 
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            // Create the array to store the CDs.
            CD[] cdLibrary = new CD[20];

            // Populate the CD library with CD objects.
            for (int i=0; i<20; i++)
            {
                cdLibrary[i] = new CD();
            }

            // Assign details to the first album.
            cdLibrary[0].Album = "See";
            cdLibrary[0].Artist = "The Sharp Band";
            cdLibrary[0].Rating = 10;
        }
    }
}

Fuente: https://msdn.microsoft.com/es-es/library/9ct4ey7x(v=vs.90).aspx