All pastes #397882 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-03-16 20:27 UTC
rendered paste body
/*  Name: Triangle  Copyright:   Author: varc  Date: 16/03/07 09:36  Description: Determines wether a triangle is isoceles, scalene, or */#include <iostream>#include <math.h>using namespace std;int main (){    int x = 0, y = 0, z = 0;    double a, aa, b, bb, c, cc;        cout << "Put the lengths of each side of a triangle to determine what type it is.\n\n";        cout << "Length of the first side : ";    cin  >> x;    cout << "Length of the second side: ";    cin  >> y;    cout << "Length of the third side : ";    cin  >> z;    if ( x != 0 && y != 0 && z != 0 )    {       if ( x + y > z || x + z > y || y + z > x )       {          a  = pow(x, 2) + pow(y, 2);          aa = pow(z, 2);          b  = pow(x, 2) + pow(z, 2);          bb = pow(y, 2);          c  = pow(y, 2) + pow(z, 2);          cc = pow(x, 2);                 if ( a == aa || b == bb || c == cc )              cout << "This is a right triangle.\n";          else if( x != y && x != z )               cout << "This is a scalene triangle.\n";          else              cout << "This is a isosceles triangle.\n";       }    }    else          cout << "All three lengths must be entered.";    return 0;}