Write a C++ statement that takes the digit character in the char variable ch and
ID: 3530217 • Letter: W
Question
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. 4. my guess is i don't understand this the question correctly.. here is what i've got which is not correct. char ch = '4'; int intVal; intVal = ch; cout << (char) intVal; it does display 4 for intVal, but is there any other way? thank youExplanation / Answer
#include#include void main() { int intVal; char ch; coutch; intVal=ch-48; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.