6. Write a switch statement to print out a string depending on the value of a ch
ID: 3652921 • Letter: 6
Question
6. Write a switch statement to print out a string depending on the value of a char variable called ch. If: * ch is 'a' print "excellent" * ch is 'b' print "good" * ch is 'c' print "ok" * if ch is anything else, print "invalid" Assume that ch has been properly declared and contains a value. 7. Write a C++ statement that takes the digit character in the char variable ch and changes it to its integer representation and saves the result in the integer variable intVal. So if ch contains '4', then intVal should contain the value 4. Assume that ch and intVal have been properly declared. 8. What is the ASCII value of the character '1'?Explanation / Answer
// 6. switch(ch) { case 'a': coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.