programa para solucionar problemas com triangulos

Publicado por Daniel Oberdá 10/03/2004

[ Hits: 7.667 ]

Download triangulo.c




Meu primeiro programa em c++

  



Esconder código-fonte

include <iostream.h>
#include <stdlib.h>
                                                                                
main ()
                                                                                
  {
      int k,soma1,soma2,soma3,num1,num2,num3;
                                                                                
        cout << "Digite o primeiro numero \n";
                                                                                
        cin >> num1;
                                                                                
        cout << "Digite o segundo numero \n";
                                                                                
        cin >> num2;
                                                                                
        cout << "Digite o terceiro numero \n";
                                                                                
        cin >> num3;
                                                                                
    soma1 = num1 + num2;
    soma2 = num2 + num3;
    soma3 = num1 + num3;
                                                                                
                                                                                
        if(soma1 > num3 && soma2 > num1 && soma3 > num2)
                                                                                
        {
                cout << "Isso e um triangulo! \n";
                k = 1;
        }
                                                                                
        if(k == 1)
                                                                                
        {
                                                                                
          if(num1 == num2 && num1 == num3 && num2 == num3)
                                                                                
            {
                                                                                
                cout << "Esse triangulo e equilatero \n";
                                                                                
            }
                                                                                
          if(num1 == num2 && num1 != num3 )
                                                                                
            {
                                                                                
                cout << "Esse triangulo e esoceles \n";
                                                                                
            }
                                                                                
          if(num2 == num3 && num2 != num1 )
                                                                                
            {
                                                                                
                cout << "Esse triangulo e esoceles \n";
                                                                                
            }
                                                                                
          if(num3 == num1 && num3 != num2 )
                                                                                
            {
                                                                                
                cout << "Esse triangulo e esoceles \n";
                                                                                
             }
                                                                                
    if(num3 != num2 && num3 != num1 && num2 != num1)
                                                                                
             {
                                                                                
                cout << "Esse triangulo e escaleno \n";
                                                                                
             }
         }
    }


Scripts recomendados

Função que converte números decimais em binários

Função simples de criptografia em um vetor

Painel de configuração placas ati

Sistem de Controle Bancario

Jogo da velha reverso


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts