
Available under Creative Commons-ShareAlike 4.0 International License.
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; }
- 瀏覽次數:1830