Write a multiple-alternative if statement equivalent to the switch statement described in question 1.





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:


if (intVal == 8)
cout << "backspace" << endl;
else if (intVal == 9)
cout << "tab" << endl;
else if (intVal == 10)
cout << "newline" << endl;
else if (intVal == 12)
cout << "formfeed" << endl;
else if (intVal == 13)
cout << "carriage return" << endl;
else
cout << "unknown character" << endl;

Computer Science & Information Technology

You might also like to view...

When designing a presentation, you should plan on displaying a new slide every minute

Indicate whether the statement is true or false

Computer Science & Information Technology

On Linux, where are the commands required for system administration stored?

A. /bin B. /usr C. /opt D. /sbin

Computer Science & Information Technology