Using the table below, write a switch statement that displays the name of the character, given its ASCII integer value. If the value is not in the table, display the message "unknown character." Assume that the ASCII integer is the value of the variable intVal.





A character is stored in memory in one byte according to a specific encoding. Many machines use ASCII character codes. A character is considered to have the integer value corresponding to its ASCII encoding. Nonprintable control characters also have ASCII values. For example:



switch (intVal) {
case 8: cout << "backspace" << endl;
break;

case 9: cout << "tab" << endl;
break;

case 10: cout << "newline" << endl;
break;

case 12: cout << "formfeed" << endl;
break;

case 13: cout << "carriage return" << endl;
break;

default: cout << "unknown character" << endl;
}

Computer Science & Information Technology

You might also like to view...

Which of the following algorithms solves the all-pair shortest path problem?

a. Floyd-Warshall’s algorithm b. Bellman-Ford’s algorithm c. Dijkstra's algorithm d. Prim’s algorithm

Computer Science & Information Technology

The Windows Firewall New (Inbound or Outbound) Rule Wizard starts with a Rule Type page, which enables you to define the type of rule you want to create. The type of rule that applies to combinations of programs and ports is called ________

a. Program b. Port c. Predefined d. Custom

Computer Science & Information Technology

Which of the following is not true about a Fill color?

A. It is color that displays behind the data in the cell. B. It can help the data stand out. C. It cannot be applied to an entire row or column. D. It should contrast with the font color.

Computer Science & Information Technology

In the context of exploring div elements,any word can be used as a(n) _____, as long as it does not contain spaces.?

A. ?header element B. ?footer tag C. ?id attribute value D. ?class name

Computer Science & Information Technology