Function of cin.get()?

I dont understand the function of cin.get() function like when we input hello world .
ch will only contain h. Then we are putting h in all the a[i]. I dont understand this?
please help

hello @sahasoumyajit2020

cin.get() read one char at a time.

so if input is hello world.
then first it reads h and assign it to a[0] and then
it reads e and assign it to a[1] and then
it reads l and assign it to a[2]
similary it will continue till we find delimeter in this case it is \n

But cin.get() is not inside the loop how it is taking the input that way

it is there

ss

check line 17

ok i get it thanks i was having a issue with the updation of ch inside the loop i got that

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.