RightTriangle

RightTriangle - cout << "Enter the value for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* A program to compute the area and hypotenuse of a right triangle from the lengths of the sides adjacent to the right angle. Author: Charles Swanson Transcribed by Eric Van Wyk Date: January 19, 2010 */ #include <iostream> #include <cmath> using namespace std ; int main() { // Declare the variables. double a, b, hypotenuse, area ; // Get input from user for a and b.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "Enter the value for side a: " ; cin >> a ; cout << "Enter the value for side b: " ; cin >> b ; // Compute area and hypotenuse. area = 0.5 * a * b ; hypotenuse = sqrt( a * a + b * b ) ; // Display results. cout << "Area = " << area << endl ; cout << "Hypotenuse = " << hypotenuse << endl ; return 0 ; }...
View Full Document

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Ask a homework question - tutors are online