char ch;

cout<<"Enter a character";

cin>>ch;

Consider the above code, a user gives 9 to the variable ‘ch’. Is there any problem? Is it valid?

7 views

1 Answers

There is no problem and it is valid since 9 is a character. Any symbol from the key board is treated as a character.

7 views