Docsity

Tarea #3 Programacion Eldrin salomon, Ejercicios de Programación C

Toggle sidebar
bg1
Ejercicio #1 programa de calculadora
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
String OTRO;
do {
Console.ForegroundColor = ConsoleColor.DarkRed;
for (int Y1 = 0; Y1 <= Console.WindowWidth - 1; Y1++)
{
Console.Write("=");
}
String P1 = "UNIVERSIDAD DE SAN PEDRO SULA";
String P2 = "Estudiante : ANGEL JOSEPH VALDIVIEZO LEIVA / 3190024";
String P3 = "CALCULADORA";
pf3
pf4
pf5
pf8

Vista previa parcial del texto

¡Descarga Tarea #3 Programacion Eldrin salomon y más Ejercicios en PDF de Programación C solo en Docsity!

Ejercicio #1 programa de calculadora using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp { class Program { static void Main(string[] args) { String OTRO; do { Console.ForegroundColor = ConsoleColor.DarkRed; for (int Y1 = 0; Y1 <= Console.WindowWidth - 1; Y1++) { Console.Write("="); } String P1 = "UNIVERSIDAD DE SAN PEDRO SULA"; String P2 = "Estudiante : ANGEL JOSEPH VALDIVIEZO LEIVA / 3190024"; String P3 = "CALCULADORA";

Console.SetCursorPosition((Console.WindowWidth - P1.Length) / 2, 1); Console.WriteLine(P1); Console.SetCursorPosition((Console.WindowWidth - P2.Length) / 2, 2); Console.WriteLine(P2); Console.SetCursorPosition((Console.WindowWidth - P3.Length) / 2, 3); Console.WriteLine(P3); for (int Y2 = 0; Y2 <= Console.WindowWidth - 1; Y2++) { Console.Write("="); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("Ingrese el primer numero...."); int X1; int.TryParse(Console.ReadLine(), out X1); Console.Write("Ingrese el segundo numero..."); int X2; int.TryParse(Console.ReadLine(), out X2); Console.WriteLine(); Console.Write("Ingrese el # de la opcion deseada [1-Suma / 2-Resta / 3- Multiplicacion]..."); int X3; int.TryParse(Console.ReadLine(), out X3); if (X3 == 1) { Console.WriteLine();

Console.Clear(); } while (OTRO == "S"); } } } Ejercicio #2 Programa de control de datos de personas using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace ConsoleApp { class Program { static void Main(string[] args) { String OTRO; string Guardar;

do { Console.Clear(); String X1 = ("UNIVERSIDAD DE SAN PEDRO SULA"); String X2 = ("ESTUDIANTE : ANGEL JOSEPH VALDIVIEZO LEIVA / 3190024"); String X3 = ("CONTROL DE DATOS DE PERSONAS"); Console.ForegroundColor = ConsoleColor.DarkRed; for (int Y1 = 0; Y1 <= Console.WindowWidth - 1; Y1++) { Console.Write("="); } Console.WriteLine(); Console.SetCursorPosition((Console.WindowWidth - X1.Length) / 2, 1); Console.Write(X1); Console.SetCursorPosition((Console.WindowWidth - X2.Length) / 2, 2); Console.Write(X2); Console.SetCursorPosition((Console.WindowWidth - X3.Length) / 2, 3); Console.Write(X3); Console.WriteLine(); for (int Y2 = 0; Y2 <= Console.WindowWidth - 1; Y2++) { Console.Write("="); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Gray;

if (EXISTE == false) { using (StreamWriter CLASE = new StreamWriter("./PERSONAS.xls")) { CLASE.Write("NOMBRE" + "\t" + "DIRECCION" + "\t" + "NACIONALIDAD" + "
t" + "TELEFONO" + "\t" + "SUELDO"); CLASE.WriteLine(); CLASE.Write(Nom + "\t" + Dir + "\t" + Nac + "\t" + Tel + "\t" + Sueldo); } } else { using (StreamWriter CLASE = File.AppendText("./PERSONAS.xls")) { CLASE.WriteLine(); CLASE.Write(Nom + "\t" + Dir + "\t" + Nac + "\t" + Tel + "\t" + Sueldo); } } } Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Desea ingresar otro registo al sistema (S/N)....: "); Console.ForegroundColor = ConsoleColor.Gray;

OTRO = Console.ReadLine().ToUpper(); } while (OTRO == "S"); } } }