vault backup: 2024-09-18 11:47:12

This commit is contained in:
zleyyij 2024-09-18 11:47:12 -06:00
parent 0ac24032c0
commit 5dfd3085bb

View File

@ -59,4 +59,31 @@ switch (i % 3) {
The program would print `onetwo` because each case is missing a `break` statement.
> 11. The following table shows the telephone ar
> 11. The following table shows the telephone area codes in the state of Georgia along with the largest city in each area:
| Area code | Major city |
| --------- | ---------- |
| 229 | Albany |
| 404 | Atlanta |
| 470 | Atlanta |
| 478 | Macon |
| 678 | Atlanta |
| 706 | Columbus |
| 762 | Columbus |
| 770 | Atlanta |
| 912 | Savannah |
> Write a switch statement whose controlling expression is the variable `area_code`. If the value of `area_code` is not in the table, the `switch` statement will print the corresponding city name. Otherwise, the `switch` statement will display the message `"Area code not recognized."` Use the techniques discussed in section 5.3 to make the `switch` as simple as possible.
```c
int area_code = 0;
switch (area_code) {
case 404:
case 470:
case 678:
case 770:
printf("Atlanta");
break;
case
}
```