is cin.get(). only use with char data type.As i used it with int data type it showing error.
Error in using cin.get()
Hello @Ajitverma1503,
Yes, you are right.
As you see it’s syntax:
cin.get(char &ch)
It reads an input character and store it in ch.
If you wants to read an integer, then you can do that as:
- Read the integer as character and
- Then convert it into integer explicitly.
You would learn later in course, how to convert a character to it’s equivalent integer.
Hope, this would help.
Give a like, if you are satisfied.