Advertisement
okelikai

areaCalculator

Oct 2nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip> // for constant
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     double inputHeight, inputLength, outputArea; // basic math
  9.     const double ONE_HALF = .5; // to multiply base and height by
  10.    
  11.     cout << "Input the height of the right triangele: ";
  12.     cin >> inputHeight;
  13.     cout << "Input the length of the right triangele: ";
  14.     cin >> inputLength;
  15.    
  16.     outputArea = ONE_HALF*(inputHeight*inputLength);
  17.    
  18.     cout << '\n' << "The area of the right triangle is: " << outputArea;
  19.    
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement