You are here

Problem 11b -Instructions

6 February, 2015 - 15:30

Explain why we are using the "if then else" to manipulate the input data in the example below.

Example 11.1: C++ source code

cout << "nnEnter one side of the rectangle --------->: " ;cin >> side1;cout << "nnEnter the other side of the rectangle --->: " ;cin >> side2;
if (side1 > side2)  {  length = side1;  width = side2;  }else  {  length = side2;  width = side1;  }