Professional Documents
Culture Documents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
class operaciones
{
static void Main(string[] args)
Console.Clear();
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Yellow;
string N1 = "UNIVERSIDAD DE SAN PEDRO SULA";
string N2 = "ALUMNA: ROSA ELISA CALDERON CARRASCO";
string N3 = "ASIGNATURA: PROGRAMACION I (2P-2021)";
string N4 = "PROGRAMA DE COMPRAS DE PRODUCTOS";
string N5 = "FECHA DE ENTREGA: 26/06/2021 ";
Console.WriteLine();
Console.WriteLine(DateTime.Now.ToLongDateString());
DateTime hora = DateTime.Now;
Console.WriteLine(string.Format("{0:hhhh:mm}", hora));
Console.WriteLine();
string NPR;
int CantP;
int Total;
int Precio;
Console.WriteLine();
Console.Write(" Ingrese el nombre del producto a comprar....: ");
NPR = Console.ReadLine();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("¿Desea guardar el registro de compra? (S/N)");
string GUARDAR = Console.ReadLine().ToUpper();
if (GUARDAR == "S")
{
bool EXISTE = File.Exists("./ compras.xls");
if (EXISTE == false)
{
using (StreamWriter PRG = new StreamWriter(" ./compras.xls"))
{
PRG.Write("producto" + "\t" + "cant" + "\t" + "precio" + "\
t" + "totalidad");
PRG.WriteLine();
PRG.Write(NPR + "\t" + CantP + "\t" + Precio + "\t" + Total
+ "\t");
}
}
else
{
using (StreamWriter PRG = File.AppendText("./compras.xls"))
{
PRG.Write(NPR + "\t" + CantP + "\t" + Precio + "\t" + Total
+ "\t");
}
}
}
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("¿Desea realizar otra Operacion Matematica? (S/N)... ");
Console.ForegroundColor = ConsoleColor.Gray;
string ciclo = Console.ReadLine().ToUpper();
switch (ciclo)
{
case "S": Console.Clear(); break;
case "N": CICLO = false; break;
default: Console.Beep(); Environment.Exit(0); break;
}
Console.ReadKey();
}
}