Error in using cin.get()

is cin.get(). only use with char data type.As i used it with int data type it showing error.

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:

  1. Read the integer as character and
  2. 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.