elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7 8
21  Programación / .NET (C#, VB.NET, ASP) / Re: Uso de raiz cuadrada en C# en: 28 Febrero 2011, 19:38 pm
Como puedo hcer la parte de la herencia,clases y polimorfismo. Aunq de por si ya estoy usando una clase principal...
22  Programación / .NET (C#, VB.NET, ASP) / Re: Uso de raiz cuadrada en C# en: 28 Febrero 2011, 18:46 pm
Ahora si me corrio  ;D nada mas me falta lo demas
23  Programación / .NET (C#, VB.NET, ASP) / Re: Uso de raiz cuadrada en C# en: 28 Febrero 2011, 16:38 pm
No me funciono del todo, sin embargo al final le quite la propiedad "textVisor.text" al evento clic que tiene que ver con ese boton. Sin embargo tengo otra duda, el ejercicio se ha complicado mas xq ahora resulta que debe llevar clases, polimorfismo y herencia.

¿Como puedo hacer esto?, la verdad no tengo mucha experiencia programando, sin embargo se me ocurre que puedo hacer la potenciacion y la raiz cuadrada usando clases, y de alli mismo puedo hacr herencia y polimorfismo. ¿Es asi?
24  Programación / .NET (C#, VB.NET, ASP) / Uso de raiz cuadrada en C# en: 28 Febrero 2011, 03:04 am
Hol amigos, estoy haciendo un proyecto de la uni, debo hacer una calculadora sencilla en c#, debe restar, sumar, mult, div, sacar potencias y raiz cuadrada ya tengo casi todas las clases sin embargo tengo problemas con la raiz cuadrada, no se si estoy usando mal la clase pero no logro correrla me da error, pero no tengo idea de que debo corregir a ver si me ayudan, En la linea del evento  
Código:
butRaiz_Click
, arroja el error: La cadena de entrada no tiene el formato correcto. aca esta el codigo:


Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8.  
  9. namespace Proyectogestor
  10. {
  11.    public partial class Form1 : Form
  12.    {
  13.  
  14.        //Variables globales...
  15.  
  16.        float num1;
  17.        string op;
  18.  
  19.  
  20.  
  21.        public Form1()
  22.        {
  23.            InitializeComponent();
  24.        }
  25.  
  26.  
  27.        //Boton igual...
  28.  
  29.        private void butIgual_Click(object sender, EventArgs e)
  30.        {
  31.            float num2;
  32.  
  33.  
  34.            try
  35.            {
  36.                num2 = float.Parse(textVisor.Text);
  37.  
  38.                switch (op)
  39.                {
  40.                    case "sumar":
  41.                        textVisor.Text = "" + suma(num1, num2);
  42.                        break;
  43.  
  44.                    case "restar":
  45.                        textVisor.Text = "" + resta(num1, num2);
  46.                        break;
  47.  
  48.                    case "multiplicar":
  49.                        textVisor.Text = "" + multi(num1, num2);
  50.                        break;
  51.  
  52.                    case "dividir":
  53.                        textVisor.Text = "" + divi(num1, num2);
  54.                        break;
  55.  
  56.                    case "potenciar":
  57.                        textVisor.Text = "" + Math.Pow(num1,num2);
  58.                        break;
  59.  
  60.                    case "raiz":
  61.                        textVisor.Text = "" + Math.Sqrt(num1);
  62.                         break;
  63.  
  64.  
  65.                }  
  66.            }
  67.            catch (Exception aviso)
  68.            {
  69.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  70.                throw;
  71.            }
  72.  
  73.        }
  74.  
  75.  
  76.        //Metodos de las operaciones...
  77.  
  78.        public float suma(float num3, float num4)
  79.        {
  80.            try
  81.            {
  82.                return (num3 + num4);
  83.            }
  84.  
  85.            catch (Exception ex1)
  86.            {
  87.                MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  88.                throw;
  89.            }
  90.  
  91.        }
  92.        public float resta(float num3, float num4)
  93.        {
  94.            try
  95.            {
  96.                return (num3 - num4);
  97.            }
  98.  
  99.            catch (Exception ex1)
  100.            {
  101.                MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  102.                throw;
  103.            }
  104.  
  105.        }
  106.        public float multi(float num3, float num4)
  107.        {
  108.            try
  109.            {
  110.                return (num3 * num4);
  111.            }
  112.  
  113.            catch (Exception ex1)
  114.            {
  115.                MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  116.                throw;
  117.            }
  118.  
  119.        }
  120.        public float divi(float num3, float num4)
  121.        {
  122.            try
  123.            {
  124.                return (num3 / num4);
  125.            }
  126.  
  127.            catch (Exception ex1)
  128.            {
  129.                MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  130.                throw;
  131.            }
  132.        }
  133.  
  134.  
  135.        //Numeros...
  136.  
  137.        private void but0_Click(object sender, EventArgs e)
  138.        {
  139.            textVisor.Text = textVisor.Text + "0";
  140.        }
  141.  
  142.        private void butComa_Click(object sender, EventArgs e)
  143.        {
  144.            textVisor.Text = textVisor.Text + ",";
  145.            butComa.Enabled = false;
  146.        }
  147.  
  148.        private void but1_Click(object sender, EventArgs e)
  149.        {
  150.            textVisor.Text = textVisor.Text + "1";
  151.        }
  152.  
  153.        private void but2_Click(object sender, EventArgs e)
  154.        {
  155.            textVisor.Text = textVisor.Text + "2";
  156.        }
  157.  
  158.        private void but3_Click(object sender, EventArgs e)
  159.        {
  160.            textVisor.Text = textVisor.Text + "3";
  161.        }
  162.  
  163.        private void but4_Click(object sender, EventArgs e)
  164.        {
  165.            textVisor.Text = textVisor.Text + "4";
  166.        }
  167.  
  168.        private void but5_Click(object sender, EventArgs e)
  169.        {
  170.            textVisor.Text = textVisor.Text + "5";
  171.        }
  172.  
  173.        private void but6_Click(object sender, EventArgs e)
  174.        {
  175.            textVisor.Text = textVisor.Text + "6";
  176.        }
  177.  
  178.        private void but7_Click(object sender, EventArgs e)
  179.        {
  180.            textVisor.Text = textVisor.Text + "7";
  181.        }
  182.  
  183.        private void but8_Click(object sender, EventArgs e)
  184.        {
  185.            textVisor.Text = textVisor.Text + "8";
  186.        }
  187.  
  188.        private void but9_Click(object sender, EventArgs e)
  189.        {
  190.            textVisor.Text = textVisor.Text + "9";
  191.        }
  192.  
  193.  
  194.        //Botones adicionales...
  195.  
  196.        private void butSalir_Click(object sender, EventArgs e)
  197.        {
  198.            Close();
  199.        }
  200.  
  201.        private void butLimpiar_Click(object sender, EventArgs e)
  202.        {
  203.            textVisor.Text = "";
  204.        }
  205.  
  206.  
  207.        //Botones de operaciones...
  208.  
  209.        private void butMas_Click(object sender, EventArgs e)
  210.        {
  211.            butComa.Enabled = true;
  212.  
  213.            try
  214.            {
  215.                num1 = float.Parse(textVisor.Text);
  216.            }
  217.            catch (Exception aviso)
  218.            {
  219.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  220.                throw;
  221.            }
  222.            textVisor.Text = "";
  223.            op = "sumar";
  224.        }
  225.  
  226.        private void butMenos_Click(object sender, EventArgs e)
  227.        {
  228.            butComa.Enabled = true;
  229.  
  230.            try
  231.            {
  232.                num1 = float.Parse(textVisor.Text);
  233.            }
  234.            catch (Exception aviso)
  235.            {
  236.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  237.                throw;
  238.            }
  239.            textVisor.Text = "";
  240.            op = "restar";
  241.        }
  242.  
  243.        private void butPor_Click(object sender, EventArgs e)
  244.        {
  245.            butComa.Enabled = true;
  246.  
  247.            try
  248.            {
  249.                num1 = float.Parse(textVisor.Text);
  250.            }
  251.            catch (Exception aviso)
  252.            {
  253.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  254.                throw;
  255.            }
  256.            textVisor.Text = "";
  257.            op = "multiplicar";
  258.        }
  259.  
  260.        private void butDivis_Click(object sender, EventArgs e)
  261.        {
  262.            butComa.Enabled = true;
  263.  
  264.            try
  265.            {
  266.                num1 = float.Parse(textVisor.Text);
  267.            }
  268.            catch (Exception aviso)
  269.            {
  270.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  271.                throw;
  272.            }
  273.            textVisor.Text = "";
  274.            op = "dividir";
  275.        }
  276.  
  277.        private void butPot_Click(object sender, EventArgs e)
  278.        {
  279.            butComa.Enabled = true;
  280.  
  281.            try
  282.            {
  283.                num1 = float.Parse(textVisor.Text);
  284.            }
  285.            catch (Exception aviso)
  286.            {
  287.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  288.                throw;
  289.            }
  290.            textVisor.Text = "";
  291.            op = "potenciar";
  292.        }
  293.  
  294.        private void butRaiz_Click(object sender, EventArgs e)
  295.        {
  296.            butComa.Enabled = true;
  297.  
  298.            try
  299.            {
  300.                num1 = float.Parse(textVisor.Text);
  301.            }
  302.            catch (Exception aviso)
  303.            {
  304.                MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
  305.                throw;  
  306.            }
  307.            textVisor.Text = "";
  308.            op = "raiz";
  309.        }
  310.  
  311.  
  312.        private void Form1_Load(object sender, EventArgs e)
  313.        {
  314.  
  315.        }
  316.  
  317.  
  318.    }
  319. }
  320.  
25  Informática / Hardware / Re: Como limpiar contactos del cabezal interno de la impresora en: 17 Febrero 2011, 02:26 am
Esta violento ese link justo lo que necesitaba! Super completo!. En parte me da verguenza... Muchas gracias hermano!
26  Informática / Hardware / Como limpiar contactos del cabezal interno de la impresora en: 16 Febrero 2011, 05:00 am
Hola Estimados, tengo un rollo con una impresora es un HP F380, lo cierto es que le monte un sistema de tinta continua pero uno de los agujeros del cartucho precisamente por donde entra la tinta desde los tanques se empezo a botar y me mancho los contactos del cabezal interno de la impresora. ¿Hay alguna forma de limpiarlos?
27  Seguridad Informática / Seguridad / Recomendacion antivirus para servidor en: 22 Noviembre 2010, 14:50 pm
Hola gente, que antivirus para un servidor bajo windows server 2003 y una red de 32 equipos?. Saludos
28  Comunicaciones / Redes / Re: [Solucionado]Problemas conectividad de red en: 12 Noviembre 2010, 03:09 am
Estas 100% seguro, xq apenas le aplique el cambio de zona de una vez empezo a agarrar conexion...
29  Comunicaciones / Redes / Re: Problemas coenctividad de red en: 11 Noviembre 2010, 14:11 pm
Solucione el problema!. Al final solo cambie la zona horaria a la zona correcta y listo!, claro lo hice solo por hacerlo pero alguien puede decirme ¿que relacion tiene esto con el problema que comente?
30  Comunicaciones / Redes / [Solucionado]Problemas conectividad de red en: 9 Noviembre 2010, 21:25 pm
Tengo 3 Switch Cisco. Mi duda es que Uno de los 33 equipos conectados a la red no daba conexion a la red, ya que salia el tipico icono con una "x" roja de "cable desconectado", pues aproveche que como estaba lenta y tenia spyware la formatie, luego al colocarle los controladores ethernet... Seguia el mismo rollo, entonces intente descargar algun desperfecto del punto de red utilizando el tester, y la prueba salio bien, y de igual manera probe el cableado y todo bien. Lo extraño es que cuando un equipo de mi red presenta este problema el equipo recupera la conectividad al siguiente dia. Probe reiniciando los switch pero el problema persite.. ¿Que puede estar pasando? ¿que deberia chequear?. Espero su ayuda gracias.
Páginas: 1 2 [3] 4 5 6 7 8
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines