Visiten el canal de un amigo Angel Esquivel que hace tutoriales muy buenos en C# programas visuales y de consola.
http://www.youtube.com/channel/UChPxLfRuQFmMNm5zJR_CqpA
Los mejores Programas en C# (Aplicaciones de Consola) del año 2013
Hice este blog porque me lo pidieron en la escuela.
domingo, 5 de mayo de 2013
martes, 19 de febrero de 2013
Semaforo en C# usando el Beep (Aplicacion de consola)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace semaforo_uadec_consola
{
class Semáforo
{
static void Main(string[] args)
{
int i = 0, c = 0;
Console.BackgroundColor = ConsoleColor.Cyan;
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.Clear();
// for (i = 0; i <= 10; i++);
do
{
i++;
c++;
if (c == 1) Console.Write("UNIVERSIDAD");
Console.WriteLine();
if (c == 2) Console.Write(" AUTONOMA");
Console.WriteLine();
if (c == 3) Console.Write(" DE");
Console.WriteLine();
if (c == 4) Console.Write(" COAHUILA");
Console.WriteLine();
if (c == 5) Console.Write("UNIVERSIDAD AUTONOMA DE COAHUILA");
Console.WriteLine();
if (c == 6) Console.WriteLine("");
Console.WriteLine();
if (c == 7) c = 0;
Console.WriteLine();
System.Threading.Thread.Sleep(500);
Console.Beep();
Console.Clear();
if (i == 35) break;
} while (true);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace semaforo_uadec_consola
{
class Semáforo
{
static void Main(string[] args)
{
int i = 0, c = 0;
Console.BackgroundColor = ConsoleColor.Cyan;
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.Clear();
// for (i = 0; i <= 10; i++);
do
{
i++;
c++;
if (c == 1) Console.Write("UNIVERSIDAD");
Console.WriteLine();
if (c == 2) Console.Write(" AUTONOMA");
Console.WriteLine();
if (c == 3) Console.Write(" DE");
Console.WriteLine();
if (c == 4) Console.Write(" COAHUILA");
Console.WriteLine();
if (c == 5) Console.Write("UNIVERSIDAD AUTONOMA DE COAHUILA");
Console.WriteLine();
if (c == 6) Console.WriteLine("");
Console.WriteLine();
if (c == 7) c = 0;
Console.WriteLine();
System.Threading.Thread.Sleep(500);
Console.Beep();
Console.Clear();
if (i == 35) break;
} while (true);
Console.ReadKey();
}
}
}
Concatenar nombre de una persona y que te diga cuantas letras tiene C#(Aplicaciones de consola)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nombrecompleto
{
class concatenar_nombre_completo
{
static void Main(string[] args)
{
String nombre = "", apellidomat = "", apellidopat = "", tl = "", te = "";
int i = 0, j = 0, a = 0;
Console.WriteLine("Dame el nombre: ");
nombre = Console.ReadLine();
Console.WriteLine("Dame el apellido paterno:");
apellidopat = Console.ReadLine();
Console.WriteLine("Dame el apellido materno:");
apellidomat = Console.ReadLine();
Console.WriteLine("El nombre completo es: " + " " + nombre + " " + apellidopat + " " + apellidomat);
tl = nombre + "" + apellidopat + "" + apellidomat;
for (i = 0; i <= tl.Length - 1; i++)
{
te = tl.Substring(i, 1);
if (te != " ") j++;
if (te == " ") a++;
}
Console.WriteLine("El total de letras es " + j);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nombrecompleto
{
class concatenar_nombre_completo
{
static void Main(string[] args)
{
String nombre = "", apellidomat = "", apellidopat = "", tl = "", te = "";
int i = 0, j = 0, a = 0;
Console.WriteLine("Dame el nombre: ");
nombre = Console.ReadLine();
Console.WriteLine("Dame el apellido paterno:");
apellidopat = Console.ReadLine();
Console.WriteLine("Dame el apellido materno:");
apellidomat = Console.ReadLine();
Console.WriteLine("El nombre completo es: " + " " + nombre + " " + apellidopat + " " + apellidomat);
tl = nombre + "" + apellidopat + "" + apellidomat;
for (i = 0; i <= tl.Length - 1; i++)
{
te = tl.Substring(i, 1);
if (te != " ") j++;
if (te == " ") a++;
}
Console.WriteLine("El total de letras es " + j);
Console.ReadLine();
}
}
}
Generar fecha en el formato dd/mm/aaaa en C# (Aplicaciones de consola)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace fechas
{
class fechas
{
static void Main(string[] args)
{
/*
*
* programa que capturas una fecha en formato dd//mm/aaaa
mostrando la fecha es dd de mmmmm de aaaaa
*/
String fecha = "", nuevafecha = "";
String d = "", m = "", a = "";
String mes = "";
Console.WriteLine("Ingrese la fecha en formato de dd/mm/aaaa :");
Console.WriteLine();
fecha = Console.ReadLine();
d = fecha.Substring(0, 2);
m = fecha.Substring(3, 2);
a = fecha.Substring(6, 4);
Console.WriteLine("\nDia = " + d);
Console.WriteLine("\nMes = " + m);
Console.WriteLine("\nAño = " + a);
if (m.Equals("01")) mes = "Enero";
if (m == "02") mes = "Febrero";
if (m == "03") mes = "Marzo";
if (m == "04") mes = "Abril";
if (m == "05") mes = "Mayo";
if (m == "06") mes = "Junio";
if (m == "07") mes = "Julio";
if (m == "08") mes = "Agosto";
if (m == "09") mes = "Septiembre";
if (m == "10") mes = "Octubre";
if (m == "11") mes = "Noviembre";
if (m == "12") mes = "Diciembre";
nuevafecha = "\nLa fecha es " + d + " de " + mes + " de " + a;
Console.WriteLine(nuevafecha);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace fechas
{
class fechas
{
static void Main(string[] args)
{
/*
*
* programa que capturas una fecha en formato dd//mm/aaaa
mostrando la fecha es dd de mmmmm de aaaaa
*/
String fecha = "", nuevafecha = "";
String d = "", m = "", a = "";
String mes = "";
Console.WriteLine("Ingrese la fecha en formato de dd/mm/aaaa :");
Console.WriteLine();
fecha = Console.ReadLine();
d = fecha.Substring(0, 2);
m = fecha.Substring(3, 2);
a = fecha.Substring(6, 4);
Console.WriteLine("\nDia = " + d);
Console.WriteLine("\nMes = " + m);
Console.WriteLine("\nAño = " + a);
if (m.Equals("01")) mes = "Enero";
if (m == "02") mes = "Febrero";
if (m == "03") mes = "Marzo";
if (m == "04") mes = "Abril";
if (m == "05") mes = "Mayo";
if (m == "06") mes = "Junio";
if (m == "07") mes = "Julio";
if (m == "08") mes = "Agosto";
if (m == "09") mes = "Septiembre";
if (m == "10") mes = "Octubre";
if (m == "11") mes = "Noviembre";
if (m == "12") mes = "Diciembre";
nuevafecha = "\nLa fecha es " + d + " de " + mes + " de " + a;
Console.WriteLine(nuevafecha);
Console.ReadLine();
}
}
}
Extraer Decimales en C# (Aplicaciones de consola)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Extraer_Decimales
{
class Program
{
static void Main(string[] args)
{
String numero = "", decimales="", le="";
Console.Write("Ingrese un numero con decimales ");
numero = Console.ReadLine();
int i = 0;
for (i = 0; i <= numero.Length - 1; i++)
{
le = numero.Substring(i, 1);
if (le == ".")
{
if (i <= numero.Length - 3)
decimales = numero.Substring(i + 1, 2);
else
decimales = numero.Substring(i + 1, 1) + "0";
}
}
Console.WriteLine("Los decimales extraidos son " + decimales);
Console.WriteLine("\nFactura " + decimales + "/100 M.M.");
Console.WriteLine("Los decimales son " + decimales);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Extraer_Decimales
{
class Program
{
static void Main(string[] args)
{
String numero = "", decimales="", le="";
Console.Write("Ingrese un numero con decimales ");
numero = Console.ReadLine();
int i = 0;
for (i = 0; i <= numero.Length - 1; i++)
{
le = numero.Substring(i, 1);
if (le == ".")
{
if (i <= numero.Length - 3)
decimales = numero.Substring(i + 1, 2);
else
decimales = numero.Substring(i + 1, 1) + "0";
}
}
Console.WriteLine("Los decimales extraidos son " + decimales);
Console.WriteLine("\nFactura " + decimales + "/100 M.M.");
Console.WriteLine("Los decimales son " + decimales);
Console.ReadKey();
}
}
}
Generar numeros aleatorios en C# (Aplicaciones de consola)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace aleatorios2
{
class aleatorios
{
static void Main(string[] args)
{
int[] num = new int[100];
Random objeto = new Random();
int i = 0;
for (i = 1; i <= 10; i++)
{
num[1] = objeto.Next(200, 400);
Console.WriteLine("Numero " + i + " " + num[1]);
Console.Beep();
}
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace aleatorios2
{
class aleatorios
{
static void Main(string[] args)
{
int[] num = new int[100];
Random objeto = new Random();
int i = 0;
for (i = 1; i <= 10; i++)
{
num[1] = objeto.Next(200, 400);
Console.WriteLine("Numero " + i + " " + num[1]);
Console.Beep();
}
Console.ReadKey();
}
}
}
Codificar letras en C# (Aplicaciones de consola)
para que funcione tiene que ir el nombre de la siguiente manera ej. J A C O B O (si quieres con minusculas, pero deve aber un espacio entre cada letra).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EXENTO_PERRON
{
class Program
{
static void Main(string[] args)
{
string A = "2";
string B = "4";
string C = "6";
string D = "8";
string E = "0";
string F = "$";
string G = "%";
string H = "/";
string I = "+";
string J = "*";
string K = "1";
string L = "3";
string M = "5";
string N = "7";
string O = "9";
string P = "-";
string Q = "?";
string R = "(";
string S = "}";
string T = "[";
string U = ")";
string V = "]";
string W = "}";
string X = "@";
string Y = ">";
string Z = "<";
string a = "2";
string b = "4";
string c = "6";
string d = "8";
string e = "0";
string f = "$";
string g = "%";
string h = "/";
string i = "+";
string j = "*";
string k = "1";
string l = "3";
string m = "5";
string n = "7";
string o = "9";
string p = "-";
string q = "?";
string r = "(";
string s = "}";
string t = "[";
string u = ")";
string v = "]";
string w = "}";
string x = "@";
string y = ">";
string z = "<";
Console.WriteLine(" CODIFICACION DE NOMBRE");
Console.WriteLine(" ESCRIBA UN NOMBRE A CODIFICAR:");
Console.WriteLine();
string nom = Convert.ToString(Console.ReadL ine());
string[] split = nom.Split(new Char[] { ' ', ',', ';', ':'});
foreach (string sS in split)
{
Console.ForegroundColor = ConsoleColor.Yellow;
if (sS.Trim() != "")
Console.Write(sS);
Console.ForegroundColor = ConsoleColor.Green;
switch (sS)
{
case "A":
Console.WriteLine(A);
break;
case "B":
Console.WriteLine(B);
break;
case "C":
Console.WriteLine(C);
break;
case "D":
Console.WriteLine(D);
break;
case "E":
Console.WriteLine(E);
break;
case "F":
Console.WriteLine(F);
break;
case "G":
Console.WriteLine(G);
break;
case "H":
Console.WriteLine(H);
break;
case "I":
Console.WriteLine(I);
break;
case "J":
Console.WriteLine(J);
break;
case "K":
Console.WriteLine(K);
break;
case "L":
Console.WriteLine(L);
break;
case "M":
Console.WriteLine(M);
break;
case "N":
Console.WriteLine(N);
break;
case "O":
Console.WriteLine(O);
break;
case "P":
Console.WriteLine(P);
break;
case "Q":
Console.WriteLine(Q);
break;
case "R":
Console.WriteLine(R);
break;
case "S":
Console.WriteLine(S);
break;
case "T":
Console.WriteLine(T);
break;
case "U":
Console.WriteLine(U);
break;
case "V":
Console.WriteLine(V);
break;
case "W":
Console.WriteLine(W);
break;
case "X":
Console.WriteLine(X);
break;
case "Y":
Console.WriteLine(Y);
break;
case "Z":
Console.WriteLine(Z);
break;
case "a":
Console.WriteLine(a);
break;
case "b":
Console.WriteLine(b);
break;
case "c":
Console.WriteLine(c);
break;
case "d":
Console.WriteLine(d);
break;
case "e":
Console.WriteLine(e);
break;
case "f":
Console.WriteLine(f);
break;
case "g":
Console.WriteLine(g);
break;
case "h":
Console.WriteLine(h);
break;
case "i":
Console.WriteLine(i);
break;
case "j":
Console.WriteLine(j);
break;
case "k":
Console.WriteLine(k);
break;
case "l":
Console.WriteLine(l);
break;
case "m":
Console.WriteLine(m);
break;
case "n":
Console.WriteLine(n);
break;
case "o":
Console.WriteLine(o);
break;
case "p":
Console.WriteLine(p);
break;
case "q":
Console.WriteLine(q);
break;
case "r":
Console.WriteLine(r);
break;
case "s":
Console.WriteLine(s);
break;
case "t":
Console.WriteLine(t);
break;
case "u":
Console.WriteLine(u);
break;
case "v":
Console.WriteLine(v);
break;
case "w":
Console.WriteLine(w);
break;
case "x":
Console.WriteLine(x);
break;
case "y":
Console.WriteLine(y);
break;
case "z":
Console.WriteLine(z);
break;
}
}
Console.ReadLine();
}
}
}
Suscribirse a:
Entradas (Atom)