(Debug) Explain why the if-else chain in Program can’t be replaced with a switch statement.
Program:
#includeusing namespace std;int main(){int digout;double inlbs;cout << “Enter the input weight: ”;cin >> inlbs;if (inlbs >= 90)digout = 1111;else if (inlbs >= 80)digout = 1110;else if (inlbs >= 70)digout = 1101;else if (inlbs >= 60)digout = 1100;elsedigout = 1011;cout << “The digital output is ” << digout << endl;return 0;}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.