Is there a way(function) to distingusih between different data types?

If u can, provide me with the function code, please?:)

Not generally -- you can use a union something like VARIANT structure in MS-Windows VB. But otherwise the function must already know the data type.

i know the answer:
use:

#include<typeinfo>

and the operator typeid();

i know the answer:
use:

#include<typeinfo>

and the operator typeid();

please provide example of use (or post a link).

#include<iostream>
#include<typeinfo>
using namespace std;
int main()
{
int i;

if( typeid(i)==typeid(int) )
cout<<"i is an int.";
else
cout<<"i isn't an int":
}
------------------------------
As u see, the program outputs "i is an int".

this kind of functionality is required only when the generic or metaprogramming paradigms are used. otherwise, when you write a function in a statically typed language, you already know the type of every expression.
for a tutorial on discovering and using information about types, see this: http://www.boost.org/doc/html/boost_typetraits/background.html

these books would give more information on this:
1. Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu
2. C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond
by David Abrahams, Aleksey Gurtovoy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.