if i want to check that wether the entered character is char type or int type,how can i do that?

how can i check that wether the entered character is char type of int type?

I would read the input in as a string, then loop through each charcter in the string and check whats its value is using some boolean values to make note of things.

cctype header has some nice functions such as isalpha and is digit that will allow you to accomplish this task reasonable simply.

here is a simple example of what i mean
[edit]
[snipped reason= multiple posting, even after solution provided]I'm un willing to provide a code example to such a rude poster[/snipped]

DO NOT MULTIPLE POST!
[/edit]

Chris

how can i check wether the entered character is char type or int type?

commented: 3* same thread! Unacceptable +0

If all characters are numbers from 0-9 then it is an int

otherwise it ain't.

The entered character is always of a char type. Presumably what you want is to see if that char represents a digit:

#include <cctype>
#include <iostream>

int main()
{
  char ch;

  while ( std::cin.get ( ch ) )
    std::cout<< std::boolalpha << (bool)std::isdigit ( ch ) <<'\n';
}

Three duplicate threads merged.