Ask Question

What is the printout of the following switch statement?

char ch = 'a';

switch (ch) {

case 'a': case 'A': cout << ch << endl; break;

case 'b': case 'B': cout << ch << endl; break;

case 'c': case 'C': cout << ch << endl; break;

case 'd': case 'D': cout << ch << endl;

}

+4
Answers (1)
  1. 5 March, 22:37
    0
    a

    Explanation:

    The switch statement in the question above is written in C+ + programming language. Firstly a variable of type char is declared and assigned a value of a. The switch statement then checks this value and executes the statement that follows, observe that in all cases, it checkes both the upper and lower case letters, also the value that is printed is the value stored in the variable ch and not the string ch. The code has also been to print the same output when any of the values a, b, c or d are entered.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the printout of the following switch statement? char ch = 'a'; switch (ch) { case 'a': case 'A': cout ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers