Programandote
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Agenda en C# (Archivo de texto, muy básico)

Ir abajo

Agenda en C# (Archivo de texto, muy básico) Empty Agenda en C# (Archivo de texto, muy básico)

Mensaje  Admin Sáb Nov 13, 2010 2:33 pm

using System;
using System.IO;
namespace Archivo2
{
class Program
{
static void Main(string[] args)
{
//Definición de variables
System.String Dijo="Si";
System.String Apellido;
System.String Nombre;
System.String Celular;

string fileName = "Agendita.txt";
FileStream stream = new FileStream(fileName,FileMode.Create, FileAccess.Write);
StreamWriter writer = new StreamWriter(stream);

while(Dijo=="Si")
{
//Carga los datos por teclado
Console.Write("Ingrese el Apellido: ");
Apellido = Console.ReadLine();
Console.Write("Ingrese el Nombre: ");
Nombre = Console.ReadLine();
Console.Write("Ingrese el Celular: ");
Celular = Console.ReadLine();

//Graba o escribe
writer.WriteLine("{0} {1} {2}",Apellido,Nombre,Celular);
Console.Write("Desea Ingresar otro (Si/No): ");
Dijo = Console.ReadLine();
}
writer.Close();
}
}
}
Admin
Admin
Admin

Mensajes : 35
Fecha de inscripción : 22/03/2010
Edad : 55
Localización : San Vicente

http://www.cyberalpha.com.ar

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.