![]() |
![]() |
![]() |
|
|
#1 (permalink) |
|
Insane
Join Date: Apr 2003
Location: Magic hole of no exciting weather
|
[c++] symbolic constants
I'm having trouble figuring out how to represent the value of pi in two different ways using symbolic constants. The book is giving me no useful info. Could I get some help? Thanks.
__________________
CUBS WIN, CUBS WIN!!!! - Pat Hughes "Don't surround yourself with yourself." Yes |
|
|
|
|
|
#3 (permalink) |
|
Insane
Join Date: Apr 2003
Location: Magic hole of no exciting weather
|
hey thanks. Could I also do something like: Const PI = 3.14 as the second way. Or can I just do #define PI 3.1415?
__________________
CUBS WIN, CUBS WIN!!!! - Pat Hughes "Don't surround yourself with yourself." Yes |
|
|
|
|
|
#4 (permalink) |
|
Insane
Join Date: Apr 2003
|
#define PI 3.1415 is the same method as #define PI 3.14 and Const PI = 3.14 wouldn't be a symbolic constant. Think about what #define does. It replaces the token PI in the source code with the number 3.14 before the code is compiled. Using this idea, a #define could be more than a number...
|
|
|
|
![]() |
| Bookmarks |
| Tags |
| constants, symbolic |
| Thread Tools | |
|
|