Based on the dangling-else discussion , modify the following code to produce the output shown. Use proper indentation techniques. You must not make any additional changes other than inserting braces. We eliminated the indentation from the following code to make the problem more challenging

```
if (y == 8)
if (x == 5)
cout << "@@@@@" << endl;
else
cout << "#####" << endl;
cout << "$$$$$" << endl;
cout << "&&&&&" << endl;
```
Assuming x = 5 and y = 8, the following output is produced.
```
@@@@@
&&&&&
```


```
if (y == 8) {
if (x == 5) {
cout << "@@@@@" << endl;
}
else {
cout << "#####" << endl; cout << "$$$$$" << endl; cout << "&&&&&" << endl;
}
```

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. When you create an object from a class, you use a reference variable to reference that object. 2. You should never declare a class in its own source file. 3. Because classes are reference types, objects that are instances of a class are always passed by reference. 4. Writing each class in its own separate file makes your code more organized and helps keep your source code files to a manageable size.

Computer Science & Information Technology

In a switch statement, when a break statement is encountered, an immediate transfer of control is made to

a. the default case of the switch statement b. a goto statement c. the else clause d. the statement beyond the end of the switch statement. e. none of these

Computer Science & Information Technology

If a hashing function runs in constant time, insertions, accesses, and removals of the associated keys are O(1).

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The problem wherein the user needs to scroll vertically down the web page to view information on a mobile device can be resolved by using _____.?

A. ?pulldown menus B. ?navigation viewports C. ?horizontal wireframes D. ?contextual data

Computer Science & Information Technology