An assignment of the value of a conditional expression to a variable (x =y?z:w;) can always be replaced by
a) a switch statement with assignment statements for its case statements.
b) one or more ifs with else clauses and assignment statements for its true and false clauses.
c) one or more nested while loops with assignments for the bodies of the loops.
d) one or more ifs without any else clauses and assignment statements for its yes_statement(s).
e) none of these is correct.
a) a switch statement with assignment statements for its case statements., b) one or more ifs with else clauses and assignment statements for its true and false clauses., c) one or more nested while loops with assignments for the bodies of the loops., and d) one or more ifs without any else clauses and assignment statements for its yes_statement(s).
c) is correct too, though strange. Here is one solution:
```
#include
using namespace std;
int main()
{
int x , z = 10, w =-10;
bool y = true;
while( y || (x = w))
{
while (y)
{
x = z;
break;
}
break;
}
cout << x << endl;
y = false;
while( y || (x = w))
{
while (y)
{
x = z;
break;
}
break;
}
cout << x << endl;
return 0;
}
/* Output is:
10
-10
*/
```
You might also like to view...
Identify the compiler errors, and state what is needed to eliminate the error(s).
#Include
Briefly describe a virtual local area network.
What will be an ideal response?
Adding indexes to tables speeds up the performance of database operations for large databases. What are the disadvantages of using indexes for large databases.
What will be an ideal response?
A(n) ____________________ is an object that produces each element of a container, such as a linked list, one element at a time.
Fill in the blank(s) with the appropriate word(s).