C/C++:const??????define?????????
???????????? ???????[ 2014/1/22 10:04:52 ] ?????????????? C++ const ????
????(1) ???????????????
????define??????????????????
????const????????????н????á?
????(2) ?????????鯔?
????define???????????????κ??????飬???????????
????const?????о???????????????λ?????????顣
????(3) ?洢??????
????define?????????????ж????????????????Σ??????????檔?????岻??????棬?????????????檔??
????const????????????з???(???????????????????)??
????(4)const ???????????????????????? ???磺
#define PI 3.14159 //??????
const doulbe Pi=3.14159; //?????δ??Pi????ROM?? ......
double i=Pi; //????Pi??????棬????????
double I=PI; //?????????к??滻?????????
double j=Pi; //?????????
double J=PI; //????к??滻??????η?????棡
????const???峣??????????????????????????????????????????#define????????????????????????const????????????????й???????????????????????????????????????????????? #define???????????????????????????
????(5) ?????Ч??? ???????????????const????????洢??????????????????????У????????????????????????????????洢???????????????????Ч???????
????(6) ???滻????滻?????????????????????;
?????????????滻????????????????????????檔
????const ?? #define????
????C++ ?????????const?????峣??????????? #define?????峣????????????????и???????
??????1?? const??????????????????????????????????????????????????????????顣????????????????滻?????????????飬??????????滻???????????????????????Ч?????
??????2?? ??Щ?????????????????const???????е??????????????????е????
??????????5-2-1????C++ ??????????const??????????ú???????const????????????????
????5.3 ???????????
??????????5-3-1?????????????????????????У????????????????????????????????????????????????????????????д??????????????????С?
??????????5-3-2????????????????????????????????????а?????????????????????Щ?????????
???????磺
????const float RADIUS = 100;
????const float DIAMETER = RADIUS * 2;
????5.4 ???е????
???????????????Щ?????????????Ч??????#define?????????????????????????????????????????const????????????????const???????????????????京????????????????????const?????????????????????????????????????????????????????????????????????????????????const?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11