Ir ao conteúdo
  • Cadastre-se

Programa que calcula derivada e integrais


Posts recomendados

Olá !

 

Estou tentando desenvolver um programa para uma calculadora em C# que leia um  polinomio e calcule a derivada e a integral desde polinomio.

Fiz o programa, mas consegui apenas as operações básicas da calculadora

 

Alguém teria uma ideia de como fazer?

Segue abaixo:

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Calculadora.BIM2v._1

    public partial class Calculadora : Form
    {   
        String polinomio ="";
        Double value = 0;
        String operation = "";
        bool operation_pressed = false;
        String derivada2 = "";
        Double value2 = 0;

        public Calculadora()
        {
            
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button12_Click(object sender, EventArgs e)
        {

        }

        private void button11_Click(object sender, EventArgs e)
        {

        }

       

        private void button_Click(object sender, EventArgs e)
        {
            if ((result.Text == "0") ||(operation_pressed))
                result.Clear(); //limpa o Text Box
            operation_pressed = false;
            Button b = (Button)sender;
            result.Text = result.Text + b.Text; //Faz aparecer os números no Text.Box
        }

        private void button_ClickCE(object sender, EventArgs e)
        {
            result.Text = "0";
        }

        private void operator_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            operation = b.Text;
            value = Double.Parse(result.Text);
            operation_pressed = true;  //guarda os valores da primeira variável até digitar o botão de operação
            equation.Text = value + " " + operation;
        }

        private void button16_Click(object sender, EventArgs e)
        {
            equation.Text = "";
            switch(operation) // realiza o resultado final quando aperta o botão de igual
            {
                case "+":
                    result.Text = (value + Double.Parse(result.Text)).ToString();
                    break;
                case "-":
                    result.Text = (value - Double.Parse(result.Text)).ToString();
                    break;
                case "/":
                    result.Text = (value / Double.Parse(result.Text)).ToString();
                    break;
                case "*":
                    result.Text = (value * Double.Parse(result.Text)).ToString();
                    break;         
                    
            }
        
            //operation_pressed = false; 
        }

        private void button18_Click(object sender, EventArgs e)
        {
            result.Text = "0";
            value = 0;
        }

        private void result_TextChanged(object sender, EventArgs e)
        {

        }

        private void buttonintg_Click(object sender, EventArgs e)
        {
            
        }

        private void buttonderv_Click(object sender, EventArgs e)
        {
            //derivacao = true;
            String[] derivada;
            String derivada2 = "";
            //Double value2 = 0;
            Button b = (Button)sender;
            result.Text = polinomio;
            derivada = polinomio.Split('^');
            derivada2 = derivada.ToString();
            //value2 = Double.Parse(derivada2.ToString());
            

        }

      
    }
}

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!