miércoles, 17 de septiembre de 2014

Mostrar texto oculto Visual C#

 private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = textBox1.Text;
        }

Cambiar fuente en Visual C#


 private void negrita_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Font = new Font(textBox1.Font.Name, textBox1.Font.Size, textBox1.Font.Style ^ FontStyle.Bold);
        }


 private void cursiva_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Font = new Font(textBox1.Font.Name, textBox1.Font.Size, textBox1.Font.Style ^ FontStyle.Italic);
        }

sábado, 6 de septiembre de 2014

Videojuego en c# sencillo

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Juego conecta 4 en c#


Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Editor de texto visual c#

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Blog de notas C#

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Teorema de Newton en c#

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

namespace TeoremaDeNewton
{
    class Program
    {
        static void Main(string[] args)
        {
            double n; //numero
            double aprox; //aproximacion de la raiz cuadrada
            double antaprox; //anterior aproximacion a la raiz cuadrada
            double epsilon; //coeficiente de error

            do
            {
                Console.Write("Número: ");
                n = Convert.ToDouble(Console.Read());
            }

            while (n < 0);
            do
            {
                Console.WriteLine("Raiz cuadrada aproximada: ");
                aprox = Convert.ToDouble(Console.Read());
            }

            while (aprox <= 0);
            do
            {
                Console.WriteLine("Coeficiente de error: ");
                epsilon = Convert.ToDouble(Console.Read());


            }

            while (epsilon <= 0);
            do
            {
                antaprox = aprox;
                aprox = (n/antaprox + antaprox) / 2;
            }

            while (Math.Abs(aprox - antaprox) >= epsilon);
            Console.WriteLine("La raiz cuadrada de {0:F2} es {1:F2}", n, aprox);

            Console.ReadLine();

        }

    }
   
}
Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Obtener codigo unicode de cada letra C#

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

namespace CUnicode
{
    class Program
    {
        static void Main(string[] args)
        {
            int car = 0;
            Console.WriteLine("Introduzca texto: ");
            Console.WriteLine("Para terminar pulse Ctrl+z\n");
           

            while ((car=Console.Read())>-1)

            {
                if (car != '\r' && car != '\n')

                    Console.WriteLine("El codigo unicode de "+ ( char)car+" es:"+ car);

            }

            Console.ReadLine();


        }
    }
}
Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Pitagoras en c#

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

namespace ctPitagoras
{
    class Program
    {
        static void Main(string[] args)
        {
         
            //Teorema de pitagoras

            int x = 1, y = 1, z = 0;
            Console.WriteLine("Z\t" + "X\t" + "Y");
            Console.WriteLine("__________________________");

            while(x<50)

            {
                //cALCULAR Z.COMO Z ES UN ENTERO.ALMACENA
                //LA PARTE ENTERA DE LA RAIZ CUADRADA

                z = (int)Math.Sqrt(x*x+y*y);

                while(y<=70 && z<=70)

                {
                    //si la raiz anterior fue exacta
                    //escribir z,x e y
                    if (z * z == x * x + y * y)

                        Console.WriteLine(z+"\t" +x+" \t"+y);
                    y = y + 1;
                    z = (int)Math.Sqrt(x*x+y*y);
                }

                x=x+1;y=x;

             
            }

            Console.ReadLine();

        }
    }
}
Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100


Convertir metros a pulgadas c#

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

namespace pulgadaMetro
{
    class Program
    {
        static void Main(string[] args)
        {
            double metro, pulgada;
                int contador;

            Console.WriteLine("Conversión de metros a pulgada");
            Console.WriteLine();
            contador = 0;

            for (pulgada = 1.0; pulgada <= 144.0; pulgada++)
            {
                metro = pulgada / 39.37;
                Console.WriteLine(pulgada + " pulgadas esquivale a " + metro + " metros");
                contador++;

                if (contador == 12)
                {
                    Console.WriteLine();
                    contador = 0;
                }
            }
            Console.ReadLine();
           
        }
    }
}

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100



Conversor de temperatura en c#














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

namespace ConversionTemperatura
{
    class Program
    {
        static void Main(string[] args)
        {
            double f, c;
            int contador;

            contador = 0;

            for (f = 0.0; f < 100.0; f++)
            {
                c = 5.0 / 9.0 * (f - 32.0);
                Console.WriteLine(f + " grados Farenheitson " + c + " grados celsius");

                contador++;
                //cada 10 lineas insertara una linea en blanco
                if (contador == 10)
                {
                    Console.WriteLine();
                    contador = 0;//reinicia el contador
                   
                }



            }
            Console.ReadLine();
        }
    }
}

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Convertir mayusculas a minusculas y viceversa en c#

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

namespace Ansii
{
    class Program
    {
        static void Main(string[] args)
        {

            /* ESTE PROGRAMA CONVIERTE DE MINUSCULAR A MAYUSCULAS O VICEVERSA,SI EL
             USUARIO INTRODUCE UN PUNTO;EL PROGRAMA SE DETIENE AUNTOMATICAMENTE.
           
             */
            char ch;
            int cambios = 0;

            Console.WriteLine("Escriba un punto para detenerse");

            do{
                ch=(char) Console.Read();
                if(ch>='a' && ch<='z')

                {
                    ch-=(char)32;

                    cambios++;

                    Console.Write(ch);

                }

                else if (ch>='A' && ch<='Z'){

                    ch+=(char)32;

                    cambios++;

                    Console.Write(ch);

                }

            }while  (ch !='.');



        }
    }
}

Si tienes alguna duda o agregame para platicar:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100


Metodo burbuja con cadenas c#

Hola este código te lo puedo proporcionar por:
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Método de la burbuja en c#

Este ejemplo hace uso del metodo de la burbuja con cadena de texto:

using System.Threading.Tasks;

namespace BubbleCadenas
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strs ={
                               "esto"," es"," un", " test",
                          " de"," un", " orden", " string" };

            int a, b;
            string t;
            int size;

            size = strs.Length;   //cantidad de elementos a ordenar

            //Muestra el arreglo original

            Console.Write("El arreglo original es:");

            for (int i = 0; i < size; i++)
                Console.Write(""+strs[i]);
            Console.WriteLine();

            //esto es el orden bubble de las cadenas

            for(a=1;a<size;a++)
                for (b = size - 1; b >= a; b--)
                {
                    if (strs[b - 1].CompareTo(strs[b]) > 0)
                    {
                        //cambia el orden de los elementos
                        t = strs[b - 1];
                        strs[b - 1] = strs[b];
                        strs[b] = t;
                    }
                }
            //Muestra el arreglo ordenado

            Console.Write("El arreglo ordenado es:");

            for (int i = 0; i < size; i++)
                Console.Write(" "+strs[i]);
            Console.WriteLine();
            Console.ReadLine();

      }
    }
}

Menu arboles binarios en c#





Hola este código te lo puedo proporcionar por
 Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Recorrido de arboles binarios c#



Hola este código te lo puedo proporcionar por Facebook:https://www.facebook.com/Josue.Developer
Twitter: https://twitter.com/playground_100

Arreglos paralelos c#

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

namespace Arreglos_Pararelos
{
    class Program
    {
        static void Main(string[] args)
        {
            int i;
            float PROM = 0.0f;
            float AC = 0;


            string[] nombre = new string[30];
            float[] calif = new float[30];

            for (i = 0; i < 5; i++)
            {
                for (i = 0; i < 5; i++)
                {
                    Console.WriteLine("Introduce el nombre: ");
                    nombre[i] = Convert.ToString(Console.ReadLine());

                    Console.WriteLine("Introduce tu calificacion: ");
                    calif[i] = float.Parse(Console.ReadLine());

                    AC += calif[i];
                }
            }

            PROM = AC / 5;

            Console.WriteLine("El promedio dle grupo es: " + PROM);

            for (i = 0; i < 5; i++)
            {
                if (calif[i] < PROM)
                {
                    Console.WriteLine("El nombre de los alumnos con calificacion menor al promedio: "+nombre[i]);


                }



            }


            Console.ReadLine();
        }
    }
}
       
       

Comenta y sigueme MI TWITTER

stack en c#



using System;
utilizando System.Collections.Generic;
utilizando System.Linq;
utilizando System.Text;
using System.Collections;

hola espacio de nombres
{
    Programa de clases
    {
        static void Main (string [] args)
        {

            // las variables necesarias

            int opcion = 0;

            int numero = 0;
            bool encontrado = false;

         
                Pila miPila = new Stack ();

         
            do
            {


                Console.WriteLine ("1-Insertar.");
                Console.WriteLine ("2-ELIMINAR.");
                Console.WriteLine ("pila Toda 3-ELIMINAR.");
                Console.WriteLine ("4-Buscar.");
                Console.WriteLine ("5-Salir.");
                Console.WriteLine ("Dame tu opcion:");

                opcion = int.Parse (Console.ReadLine ());

                if (opcion == 1)
                {
                    Console.WriteLine ("Dame el valor a introducir:");
                    numero = int.Parse (Console.ReadLine ());
                    miPila.Push (numero);
                }

                if (opcion == 2)
                {
                    numero = (int) miPila.Pop ();
                    Console.WriteLine ("El valor obtenido es:" + numero);
                }

                if (opcion == 3)
                {
                    miPila.Clear ();
                }


                si (== opcion 4)
                {
                    Console.WriteLine ("dame el valor de un Contar:");
                    numero = int.Parse (Console.ReadLine ());
                    encontrado = miPila.Contains (numero);
                    Console.WriteLine ("encontrado {0}", encontrado);
                }



                Console.WriteLine ("El stack Tiene {0} Elementos", miPila.Count);
                foreach (int n en miPila)
                    Console.Write ("{0}", n);
                Console.WriteLine ("");

                Console.WriteLine ("_______");

            } While (opcion = 5!);


        }
        }
    }


Tablas bidimensionales en c#





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

namespace TablasBidimensionales
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] Arreglo = new int[2, 10];
            int i;
            int j=0;
            int tabla;

            Console.WriteLine("Introduce un numero para mostara la tabla de multiplicar: ");
            tabla = int.Parse(Console.ReadLine());
            Console.ReadLine();
            for (i = 0; i < 10; i++)
            {                                
                Arreglo[0, j] = tabla;
                Arreglo[1, j] = (i+1) * tabla;
                Console.WriteLine(Arreglo[0, j] + " * " +(i+1)+ "=" + Arreglo[1, j]);

            } Console.Read();

        }
    }
}

Tablas de multiplicar en c++





#include <iostream>
#include <cstdio>
using namespace std;

void mul(int arg[], int length, int a){
     for(int n=0;n<length;n++){
             cout<<a<<" x "<<n<<" = "<<a*arg[n]<<"\n";
             cout<<"\n";
           
             }
getchar();
}

int main(){
   
    int tabladel2[11] = {0,1,2,3,4,5,6,7,8,9,10};
    int x;
    cout<<"Escribe el numero de la tabla de multiplicar que quieres:"<<endl;
    cin >> x;
    cout<<"----------------------------------------------------------"<<endl;
   
    mul(tabladel2,11,x);
    cout<<"Fin de la tabla de Multiplicar del "<<x<<endl;
    cout<<"Presione ENTER para salir";
    getchar();
    return 0;
}

Fibonacci en java

Sucesión de Fibonacci
En matemáticas, la sucesión de Fibonacci (a veces mal llamada serie de Fibonacci) es la siguiente sucesión infinita denúmeros naturales:

La sucesión comienza con los números 1 y 1,1 y a partir de estos, «cada término es la suma de los dos anteriores», es la relación de recurrencia que la define.

A los elementos de esta sucesión se les llama números de Fibonacci. Esta sucesión fue descrita en Europa por Leonardo de Pisa, matemático italiano del siglo XIII también conocido como Fibonacci. Tiene numerosas aplicaciones en ciencias de la computación, matemáticas y teoría de juegos.

package fibonacci;
import java.util.Scanner;
/**

 * @author JOSUE
 */
public class Fibonacci {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
         Scanner leer=new Scanner(System.in);
        int c;
        int a=0;
        int b=1;
        int numero,i;
        
        
        System.out.print("Introduce un numero para fibonnaci: ");
        numero=leer.nextInt();
        
        
        for(i=0;i<numero;i++){
            
            
            c=a+b;
            a=b;
            b=c;
            
              System.out.print(" "+a);
        }
        // TODO code application logic here
    }
}


martes, 22 de abril de 2014

Estructura del disco duro


Arquitectura de von Neumann


Tabla del codigo morse


Matriz Multidimensional C++

// matrices multidimensionales.cpp: archivo de proyecto principal.

#include "stdafx.h"

using namespace System;

int main(array<System::String ^> ^args)
{
int var[12][12] ={{1,2,3,4,5},{6,7,8,9,10}};

Console::WriteLine(var[1][2]);

Console::ReadLine();
}

Depreciacion del coche C#

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

DepreciacionCoche espacio de nombres
{
    class Program
    {
        static void Main (string [] args)
        {

            Console.Title = "JOSUE SANTANA ";
            int Costo, vidautil, valorRecuperacion;
            int depreciacion, valorInicialAño = 1;
            int depreciacionAcumulada;
            int valorAnual;

            Console.WriteLine ("introducir el Costo:");
            Costo = Convert.ToInt32 (Console.ReadLine ());

            Console.WriteLine ("introducir la vida util:");
            vidautil = Convert.ToInt32 (Console.ReadLine ());

            Console.WriteLine ("introducir el valor de recuperacion:");
            valorRecuperacion = Convert.ToInt32 (Console.ReadLine ());

            depreciacion = (Costo - valorRecuperacion) / vidautil;

            / / DepreciacionAcumulada = valorInicialAño * depreciacion;

           

            mientras que (valorInicialAño <= vidautil)
            {
               
                depreciacionAcumulada = valorInicialAño * depreciacion;
                valorAnual = costo-depreciacionAcumulada;
                Console.WriteLine ("Año:" + + valorInicialAño "depreciacion:" + + depreciacion "Acumulada depreciacion:"
                    + DepreciacionAcumulada + "valor anual:" + valorAnual);


                valorInicialAño + +;

            }



            Console.Write ("Pulse cualquier tecla para continuar ...");
            Console.ReadKey (true);
        }
    }
}

QuickSort generico en java


package ejemploquicksort;
import java.util.*;

public class EjemploQuickSort {

    public static void main(String[] args) {
 
        int[] arreglo={2,55,6,5,7,8,44,22,11,2,8,783};
         System.out.println("arreglo desordenado ");
       
         for(int i=0;i<arreglo.length;i++)
         {
          System.out.print(arreglo[i]+",");
       
         }
         System.out.println();
         Arrays.sort(arreglo);
       
          System.out.println("arreglo ordenado ");
         for(int i=0;i<arreglo.length;i++)
         {
          System.out.print(arreglo[i]+",");
       
         }
    }
}

Ejemplo BufferReader Java


package ejemplobufferedreader;
import java.io.*;
/**
 *
 * @author JOSUE
 */
public class EjemploBufferedReader {

    public static void main(String[] args) {
       
        throws IOException
               
                {
                    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                   
                    String str;
                   
                    System.out.println("Introduzca texto");
                    System.out.println("Introduzca ´stop´ para finalizar");
                }
               
                do{
                   
                    str=br.redLine();
                    System.out.println(str);
                   
                 
                   
                }while(!str.equals("stop"));
    }
}


Cajero automatico en JAVA

    float cant;
    InputStreamReader is;
    is=new InputStreamReader(System.in);
    BufferedReader bf=new BufferedReader(is);
    do{
      System.out.println("Elegir opción:\n");
      System.out.println("1. Crear cuenta vacía");
      System.out.println("2. Crear cuenta saldo "+
  "inicial");
      System.out.println("3. Ingresar dinero");
      System.out.println("4. Sacar dinero");
      System.out.println("5. Ver saldo");
      System.out.println("6. Salir\n");
      op=bf.readLine();
      switch(Integer.parseInt(op)){
        case 1:
            c=new Cuenta();
            break;
        case 2:
            System.out.println("Saldo inicial: ");
            float inicial=
Float.parseFloat(bf.readLine());
            c=new Cuenta(inicial);
            break;
        case 3:
            System.out.println("Introduzca cantidad "+
  " a ingresar: ");
            cant=Integer.parseInt(bf.readLine());
            c.ingresar(cant);
            break;
        case 4:
            System.out.println("Cantidad a extraer: ");
            cant=Integer.parseInt(bf.readLine());
            try{
              c.extraer(cant);
            }
            catch(SaldoInsuficienteException e){
              //si se produce la excepción muestra
   //el mensaje asociado
              System.out.println(e.getMessage());
            }
            break;
        case 5:
            System.out.println("Su saldo actual "+
" es de: "+c.getSaldo());
            break;
      }
    }
    while(!op.equals("6"));
  }
}

Conecta 4 consola C#

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

namespace Desarrollo
{
    class Program
    {


        char[,] tablero = new char[12, 12];

        void inicializar_tablero()
        {
            int i, j;
            for (i = 0; i < 12; i++)
                for (j = 0; j < 12; j++)
                    tablero[i, j] = ' ';
        }



        int jugada_corrrecta(int fila, int col)
        {
            int jugada_correcta;
            jugada_correcta = 1;

            if (fila >= 12 || fila < 0 || col >= 12 || col < 0)

                jugada_correcta = 0;

            if (jugada_correcta == 1)
            {
                if (tablero[fila, col] == '0' || tablero[fila, col] == 'X')
                    jugada_correcta = 0;
            }


            if (jugada_correcta == 1)
            {
                if (fila != 12 -1 && tablero[fila + 1, col] == ' ')
                    jugada_correcta = 0;

            }

            return jugada_correcta;

        }




        int hacer_jugada(int jug)
        {
            int fila, col;
            int i;
            char ficha;
            int resultado_jugada;
            resultado_jugada = 1;
            col = 0;

            if (jug == 0)
            {
                ficha = '0';
                Console.WriteLine("!!!!!! El usuario coloca ficha !!!!.\n");

                do
                {

                    if (resultado_jugada == 0)
                     
                        Console.WriteLine("Jugada Incorrecta.\n");

                    Console.Write("Introduce la columna en la que quieres colocar la ficha: ");
                    //creo que era columa y no ficha
                    col = int.Parse(Console.ReadLine());

                    i = 12 - 1;

                    if (tablero[12 - 1, col] != ' ')
                    {
                        while (i < 12 && (tablero[i, col] == 'X' || tablero[i, col] == '0'))

                            i--;

                    }

                    fila = i;

                    resultado_jugada = jugada_corrrecta(fila, col);

                } while (resultado_jugada == 0);

            }
            else
            {
                ficha = 'X';

                do
                {

                    col = generar_numero();

                    i = 12 - 1;

                    if (tablero[12 - 1, col] != ' ')
                    {
                        while (i < 12 && (tablero[i, col] == 'X' || tablero[i, col] == '0'))
                            i--;
                    }

                    fila = i;

                    resultado_jugada = jugada_corrrecta(fila, col);

                } while (resultado_jugada == 0);
            }

            if (resultado_jugada == 1)

                tablero[fila, col] = ficha;

            return resultado_jugada;

        }




        int generar_numero()
        {
            int num;
            num = 0;
            Random rnd = new Random();

            num = rnd.Next(0, 12);

            return num;

        }


     
       
           void mostrar_tablero()  //pinta
        {
            int i, j;
            int ficha;

            Console.Clear();  // verificar este clear tal vez se un mensaje "Clear"
            Console.WriteLine("\n");


            for (j = 0; j < 8 * 5 / 2; j++)
                Console.WriteLine("  ");

       
            Console.WriteLine("_____________________CONECTA 4________________");
           
            Console.Write("\n F ---------");
         
         
            //Console.Write("\t F -");

            for (j = 0; j < 12 + 1; j++)

                Console.Write("----");
            Console.Write("\n");

            for (i = 0; i < 12; i++)
            {
                Console.Write(" ");
                if (i == 0)
                    Console.Write("I");
                else if (i == 1)
                    Console.Write("A");

                else
                    Console.Write(" ");

                Console.Write(" | ", i);

                for (j = 0; j < 12; j++)
                {
                    Console.Write(" ");
                    Console.Write(tablero[i, j]);
                    Console.Write(" | ");
                }

                Console.Write(" ");
                if (i == 0)
                    Console.Write("\n L");
                else if (i == 1)
                    Console.Write("\n S");

                else
                    Console.Write("\n ");
                Console.Write(" -------");

                for (j = 0; j < 8 + 1; j++)

                    Console.Write("------");

                Console.Write("\n");
            }


            Console.Write("                    ");
            for (j = 0; j < 12; j++)

                Console.Write(" ", j);

            Console.Write("COLUMNAS  12\n");     //verificar aqui tal vez sea el nombre COLUMNAS  y no el numero del valor

            Console.Write("\n");
         
        }
   
       


        int comprobar_fin()
        {
            int i, j;
            int ganador;

            ganador = -1;

            //comprobar si hay 4 en linea horizontal

            for (i = 0; i < 12; i++)
            {
                for (j = 0; j < 12 - 3; j++)
                {
                    if (tablero[i, j] == 'X' && tablero[i, j + 1] == 'X' && tablero[i, j + 2] == 'X' && tablero[i, j + 3] == 'X')

                        ganador = 0;
                    else if (tablero[i, j] == '0' && tablero[i, j + 1] == '0' && tablero[i, j + 2] == '0' && tablero[1, j + 3] == '0')

                        ganador = 1;
                }
            }

            if (ganador == -1)
            {
                //comprovar si hay 4 en linea vertical

                for (i = 0; i < 12 - 3; i++)
                {
                    for (j = 0; j < 12; j++)
                    {
                        if (tablero[i, j] == 'X' && tablero[i + 1, j] == 'X' && tablero[i + 2, j] == 'X' && tablero[i + 3, j] == 'X')

                            ganador = 0;
                        else if (tablero[i, j] == '0' && tablero[i + 1, j] == '0' && tablero[i + 2, j] == '0' && tablero[i + 3, j] == '0')

                            ganador = 1;
                    }
                }
            }

            if (ganador == -1)
            {
                //comprobar si hay cuatro en linea diagonal 1

                for (i = 0; i < 12; i++)
                {
                    for (j = 0; j < 12; j++)
                    {
                        if (i + 3 < 12 && j + 3 < 12)
                        {
                            if (tablero[i, j] == 'X' && tablero[i + 1, j + 1] == 'X' && tablero[i + 2, j + 2] == 'X' && tablero[i + 3, j + 3] == 'X')

                                ganador = 0;
                            else if (tablero[i, j] == '0' && tablero[i + 1, j + 1] == '0' && tablero[i + 2, j + 2] == '0' && tablero[i + 3, j + 3] == '0')
                                ganador = 1;
                        }
                    }
                }
            }


            if (ganador == -1)
            {
                //comprobar si hay cuatro en linea en diagonal 2

                for (i = 0; i < 12; i++)
                {
                    for (j = 0; j < 12; j++)
                    {
                        if (i + 3 < 12 && j - 3 >= 0)
                        {
                            if (tablero[i, j] == 'X' && tablero[i + 1, j - 1] == 'X' && tablero[i + 2, j - 2] == 'X' && tablero[i + 3, j - 3] == 'X')

                                ganador = 0;

                            else if (tablero[i, j] == '0' && tablero[i + 1, j - 1] == '0' && tablero[i + 2, j - 2] == '0' && tablero[i + 3, j - 3] == '0')

                                ganador = 1;
                        }
                    }
                }
            }


            return ganador;
        }

        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.BackgroundColor = ConsoleColor.Cyan;
            Console.Clear();


            Program Arranque = new Program();

            int jugador;
            int total_jugadas;
            total_jugadas = 0;

            Arranque.inicializar_tablero();

            do
            {

                if (total_jugadas % 2 == 0)

                    jugador = 0;
                else
                    jugador = 1;

                total_jugadas++;

                Arranque.mostrar_tablero();

                if (Arranque.hacer_jugada(jugador) == 0)
                {
                    Console.WriteLine("Jugada Incorrecta.\n\n");

                    //Console.WriteLine("Pause");   // verificar esto
                    Console.ReadLine();

                }
            } while (Arranque.comprobar_fin() == -1);


            Arranque.mostrar_tablero();

            if (Arranque.comprobar_fin() == 1)

                Console.WriteLine("Haz Ganado.\n\n");

            else

                Console.WriteLine("Ganá la computadora!!\n\n");
        }
    }
}
       






















Ejemplo en C# StreamWriter

Otro ejemplo sencillos de streamwritter utilizando arreglos: 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int t;
Console.WriteLine("Cuantos datos necesita capturar : ?");
t =Convert.ToInt32(Console.ReadLine());

string[]a=new string [t];

for (int i = 0; i<a.Length; i++)
{
Console.WriteLine("nombre: ");
a[i] =Console.ReadLine();

}
Console.WriteLine();

Console.WriteLine("");

for (int j = 0; j <a.Length; j++)
{
//Console.WriteLine(a[j]);

StreamWriter texto = File.AppendText("agenda.txt");

texto.WriteLine(""+a[j]);
texto.Close();

}

Console.WriteLine("!!!!!!!!!!!registros almacenados correctamente!!!!!!!!!!!!!!!!!!!!");
Console.ReadLine();

}
}
}