![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2004
Posts: 2
Rep Power: 0
![]() |
I have a conditional similar to the following:
#define OTHER_NUMBER 300 ... float MyFunction(int); ... if (MyFunction(somenumber)==OTHER_NUMBER) #define OTHER_NUMBER 300.000 if ((int)MyFunction(somenumber)==OTHER_NUMBER) if (MyFunction(somenumber)==(float)OTHER_NUMBER) if (static_cast<int>(MyFunction(somenumber))==OTHER_NUMBER)//I'm not even quite sure what static_cast does... Any ideas? Thanks in advance.
__________________
<span style='color:red'>AKhalifman@hotmail.com</span> |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
You can either declare the function as int, or typecast it to an integer by placing (int) in front of the function call:
if ((int)MyFunction(somenumber) == OTHER_NUMBER) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|