fork download
  1. //Conrad Taylor CSC5 Chapter 4, P. 220, #4
  2. //
  3. /*******************************************************************************
  4.  * Rectangle Area Evaluator
  5.  * _____________________________________________________________________________
  6.  * This program takes the height and width of two triangles, calculates the area
  7.  * and tells the user which rectangle is the largest or if they are the same.
  8.  * _____________________________________________________________________________
  9.  * INPUT
  10.  * length1
  11.  * length2
  12.  * width1
  13.  * width2
  14.  *
  15.  * OUTPUT
  16.  * romanNumerals
  17.  
  18.  ******************************************************************************/
  19.  
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main() {
  24.  
  25.  
  26. float length1, length2, width1, width2, rectangle1, rectangle2;
  27.  
  28.  
  29.  
  30. cout << endl;
  31. cout << "length of the first rectangle: ";
  32. cin >> length1;
  33. cout << "What is the width: ";
  34. cin >> width1;
  35. cout << "length of the second rectangle: ";
  36. cin >> length2;
  37. cout << "What is the width: ";
  38. cin >> width2;
  39. cout << endl;
  40.  
  41.  
  42. rectangle1 = length1 * width1;
  43. rectangle2 = length2 * width2;
  44.  
  45.  
  46. if (rectangle1 > rectangle2)
  47. cout << "rectangle 1 is bigger." << endl;
  48. else if (rectangle1 < rectangle2)
  49. cout << "rectangle 2 is bigger." << endl;
  50. else if (rectangle1 == rectangle2)
  51. cout << "both rectangles are the same." << endl;
  52.  
  53.  
  54. cout << endl;
  55.  
  56.  
  57. return 0;
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. return 0;
  66. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
length of the first rectangle: What is the width: length of the second rectangle: What is the width: 
rectangle 1 is bigger.