- Joined
- Oct 7, 2014
- Messages
- 2,208
I got a task where we are required to make a program which uses decision making statements and constants/literals, so I made this program below.
The problem is I don't know how to identify if the value entered is an integer or a float.
The problem is I don't know how to identify if the value entered is an integer or a float.
C++:
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout << "enter 3 numbers";
cin >> a >> b >> c;
//Here, I wanted to check if a,b,c are integers
if (........)
{
if(a > b)
{
if( a > c)
{
cout << "a is largest number";
}
else
{
cout << "c is largest number";
}
}
else
{
if( b> c)
{
cout << "b is largest number";
}
else
{
cout << "c is largest";
}
}
}
else
{
cout << " a, b, c should be an integer";
}
}
return 0;
}