0
Can someone tell me the reason why can't it work? Thanks a lot!
2 ответов
+ 4
In the code, change 'cin.get(ch)' to 'ch = cin.get()', as the former call is for strings while you read a single character per iteration.
Also, it seems cin.get() does not trigger the input prompt in the code playground, and so to provide input, you need to add the following line outside main :
#define x cin>>
This line makes the playground assume that the program tried to call cin and you will be able to read input via cin.get().
+ 1
Thank you so much!!